Prev Next

Java / Set and its implementations

Explain CopyOnWriteArraySet in Java collection.

CopyOnWriteArraySet is a Set implementation backed up by a copy-on-write array. All mutative operations, such as add, set, and remove, are implemented by making a new copy of the array; no locking is ever required.

CopyOnWriteArraySet is best suited as read-only collection whose size is small enough to copy .CopyOnWriteArraySet is backed by CopyOnWriteArrayList.

CopyOnWriteArraySet iterators do not support the mutative remove operation.

More Related questions...

Show more question and Answers...


Comments & Discussions