| Author |
If i use a Collections.synchronizedList () i still need to synchronize that list.
|
RaviNada Kiran
Ranch Hand
Joined: Jan 30, 2009
Posts: 528
|
|
If i use a Collections.synchronizedList () i still need to synchronize that list.
Then what is the use of using this method Collections.synchronizedList ()
Please suggest your ideas.
|
If you want something you never had do something which you had never done
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
For a synchronizedList return value, all individual methods are synchronized. So you can make a single call to add, remove or get and be sure that that add / removal / retrieval is executed atomically. However, it does not make compound statements atomic. Adding two elements after each other is still not an atomic operation, and neither is iterating over it.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: If i use a Collections.synchronizedList () i still need to synchronize that list.
|
|
|