Hi,
I am trying to understand the difference between an ArrayList and a Vector. I wrote a sample program where :
-
Thread 1 just iterates through the List
- Thread 2 modifies the list
As expected I run into a
IllegalStateException where two threads access the same list.
[Exception is thrown at Thread-2]
Now, to make the program work I replace the ArrayList with Vector. And going by the definition of Vector my logic should work.
But still it does not.
Can some one explain why Vector does not work.
Thanks.
[Note: Making the progam work is not my intention here, I can add some syncronized blocks to make it work]