String line;
List < Item > items = new ArrayList < Item > ();
while ((line = myFile.readLine()) != null) {
if (line.startsWith("#")) {
continue;
}
StringTokenizer st = new StringTokenizer(line);
st.nextToken();
Media m = MediaFactory.getMedia(st.nextToken());
int stock = Integer.parseInt(st.nextToken());
int qty = Integer.parseInt(st.nextToken());
Item tmp = new Item(m, stock, qty);
items.add(tmp);
}
return new Invoice(1, 3,
(Item[]) items.toArray(new Item[items.size()]));