CopyOnWriteArraySet in Java

CopyOnWriteArraySet in Java extends the AbstractSet which in turn implements the Set interface and is part of java.util.concurrent package. How CopyOnWriteArraySet differs from other Set implementations in Java Collections framework is that it is thread-safe. CopyOnWriteArraySet internal implementation in Java CopyOnWriteArraySet internally uses CopyOnWriteArrayList for all of its operations and…

Continue reading

HashSet in Java

HashSet in Java is part of the Java Collections framework and one of the most used Set implementation in Java applications. HashSet class extends AbstractSet class and implements Set, Cloneable and Serializable interfaces. HashSet is backed by a HashMap instance that means HashSet class internally uses HashMap to store its…

Continue reading