private List<MyShape> childShapes;
public ShapeCreator() {
super();
frame = new DrawGUI();
this.childShapes = new ArrayList<MyShape>();
}
I have this piece of code and i have got to insert an infinite amount of data(th开发者_C百科e array size not fixed), which consists of integers, how would i do that, i think i must be getting confused with the this.childShapes
I would appreciate some help thanks
I could not say you formulated your question well enough... but i'll make my suggestion:
you probably want to have a method that will take the new data in as argument and insert it into the list of childShapes;
public void addShape(int whateverInt){
childShapes.add(new MyShape(whateverInt));
}
That should do. You can call this method as many times as you like... until you run out of memory. There's no such thing as infinite amount of data
. :-)
精彩评论