CyclicBarrier in Java

The java.util.concurrent package provides many synchronizers utilities that cover the use cases where several thread communicate with each other and some sort of synchronizer is needed to regulate that interaction among the threads. CyclicBarrier in Java is one such synchronization aid that is useful when you want threads to wait…

Continue reading

Interface in Java

Interface in Java helps to fully abstract the implementation of the class. Interfaces just provide a contract for the class, just providing how the class methods will be accessed by any outside entity without actually providing what methods should do. The class implementing an interface has to provide the behavior…

Continue reading

Abstract Class in Java

Abstract class in Java is a class that is declared using abstract keyword. Abstract class can have regular methods (methods with method body) as well as abstract methods (methods without method body and having abstract specifier). General form of abstract class in Java

When is abstract class needed When…

Continue reading

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