Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
1.9
-
None
-
None
-
None
Description
From the Collections#synchronizedCollection method:
* It is imperative that the user manually synchronize on the returned * collection when traversing it via {@link Iterator}, {@link Spliterator} * or {@link Stream}: * <pre> * Collection c = Collections.synchronizedCollection(myCollection); * ... * synchronized (c) { * Iterator i = c.iterator(); // Must be in the synchronized block * while (i.hasNext()) * foo(i.next()); * } * </pre> * Failure to follow this advice may result in non-deterministic behavior.