ArrayList with objects, wich also contain ArrayList

Put your problem here if it does not fit any of the other categories.

ArrayList with objects, wich also contain ArrayList

Postby Duqe » Thu Jan 27, 2011 10:03 pm

Hello.

Since its to long to explain the problem, ill paste te question i made on stackoverflow:

http://stackoverflow.com/questions/4811 ... ist-inside

As i asked there, i have an ArrayList of obj1. These objects, also have an ArrayList each one, an ArrayList of obj2. So i could have an ArrayList with 11 objs1. And each of these obj1 could have an ArrayList of obj2 of 1 to maybe 16 objs2. Hope you understand what i mean. Anyway, theres some code explaining it on the link.

And the problem is when i return the ArrayList o objs1, these objs1 dont have any ArrayList of objs2. They do have the other attributes, like some strings and integers. But not the ArrayList.

Thx in advance.
Duqe
Freshman
Freshman
 
Posts: 8
Joined: Thu Jan 27, 2011 9:56 pm

Top

Re: ArrayList with objects, wich also contain ArrayList

Postby Duqe » Fri Jan 28, 2011 1:11 am

I just found the problem. On the obj1 constructor i asigned the obj2 arraylist with "this.objs2 = objs2downloaded". I just changed it to "this.objs2 = (ArrayList<Obj2>) objs2downloaded.clone()" and it seems to work fine.
Duqe
Freshman
Freshman
 
Posts: 8
Joined: Thu Jan 27, 2011 9:56 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 12 guests