regarding object recycling
Posted
by ajaycv
on Stack Overflow
See other posts from Stack Overflow
or by ajaycv
Published on 2010-06-15T05:49:03Z
Indexed on
2010/06/15
5:52 UTC
Read the original article
Hit count: 108
java
I have a question. What is wrong with regards to the below code:
ArrayList tempList2 = new ArrayList();
tempList2 = getXYZ(tempList1, tempList2);
//method getXYZ
getXYZ(ArrayList tempList1, ArrayList tempList2) {
//does some logic and adds objects into tempList2
return tempList2;
}
The code will get executed but it seems by passing tempList2 to the getXYZ method argument, it is doing object recycling.
My question is, Is recycling the tempList2 arraylist object correct?
© Stack Overflow or respective owner