I think Javadocs for Collections.synchronizedXxx() should mention not
only "traversing it via Iterator, Spliterator or Stream" as something that
must be synchronized externally, but also cases when a synchronized
collection is an argument to a bulk collection method, including:
 - new ArrayList(syncList), new HashSet(syncSet),  etc.
 - List.copyOf(syncList)
 - otherColl.addAll(syncList), otherColl.removeAll(syncList),
otherMap.putAll(syncMap).

Though this is logically inferable, this is far from being obvious and
apparent.

Reply via email to