Case :
Let’s handle concurrency while dealing with collections in of-course a multi-threaded environment. Vector is the chosen one here. Now the system is in action and a couple of threads are accessing the same Vector.
Q. Thread A and Thread B call different methods on the Vector? Any issues?
Vector is thread safe. It's a synchronized object. So update operations are guaranteed to be atomic. However be ready for a ConcurrentModificationException
ReplyDeleteWhat if I am not using the iterator dished out by this Vector?
ReplyDelete