You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brandon Goodin <ma...@phase.ws> on 2003/04/14 18:40:42 UTC

[OT] ArrayList-Vector-Synchronization

I need to remove object(s) from a List while I am iterating through them. I
know I can use the Iterator.remove() to alter the List. But, how does
altering the list via the iterator affect other iterators that are called on
the same List.

I know that Vector IS synchronized and ArrayList IS NOT. When I alter a List
via the itertor that is created from a synchronized List or a Vector, will
it affect all iterators called on that List?

With Vector or Collections.synchronizedList does it allow only a single
thread to access a particular list's iterator at a time (read or write)
therefore avoiding ConcurrentModificationException?

Finally, what is the advantage of using A over B?:

A) List list = Collections.synchronizedList(new ArrayList());
B) List list = new Vector();

I know this is JAVA 101. But, I just want to finally be absolutely clear on
this. I know the High IQs around here are good place to plunder for this
kind of loose ends knowledge.

Brandon Goodin



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org