java - How can I create a variable that will contained an unknown number of objects? -


i have procedure recursively generates objects. procedure takes "last" object , generate "new" one, "new" object considered "last" 1 , on until "new" object cannot generated.

i need save generated object. thought use array problem not know in advance how many objects generated (so, cannot specify length of array when declare it).

is there way in java have arrays without fixed length? or may should use not array else?

go arraylist

list<yourclass> list = new arraylist<yourclass>(); list.add(obj1); list.add(obj2); list.add(obj3); . .  . 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -