01: package demo.data;
02:
03: import java.util.ArrayList;
04:
05: public class Order {
06: private int id;
07: private ArrayList items;
08:
09: public Order(int aId) {
10: id = aId;
11: items = new ArrayList();
12: }
13:
14: public int getId() {
15: return id;
16: }
17:
18: public void addItem(Item aItem) {
19: items.add(aItem);
20: }
21:
22: public Item[] getItems() {
23: Object objs[] = items.toArray();
24: Item items[] = new Item[objs.length];
25: System.arraycopy(objs, 0, items, 0, items.length);
26: return items;
27: }
28: }
|