Re: List as Class Variable and Local Variable
Posted By:
Anin_Mathen
Posted On:
Friday, January 2, 2004 11:55 AM
Vivek,
Your question is kinda missing in some details but from what I could surmise, this is the answer I have for you.
Just by synchronizing your list doesnt make it a different copy. All the assignment that you are performing in your actions in the method are nothing but reference assignments. So when you perform a subList() call you are actually affecting both the syncretrievedList as well as the retrievedList.
The solution is to use shallow or deep cloning to get a copy of the original object.
That should explain why you are getting the same sizes.
Hope this helps.
Anin