What is an Interface? An Interface is like a class in that it can have methods and variables. However, methods declared in an Interface are abstract by default, meaning they only contain the method signature, not the method body. Facts about Interfaces: Interfaces specify what the class must do and not how the class must do it. They are considered as the class blueprint. If a class implements an interface, the class must provide all the method bodies for the interface's functions. Otherwise, the class must be declared abstract. They are used to achieve total abstraction. An Interface can extend one or many Interfaces. A class can extend many Interfaces, but only one class. Nested Interfaces is when an Interface is declared inside another interface. It is also used to achieve loose coupling. Interfaces are used to implement abstraction. Difference between Abstract Class and Interface: Differences between an Abstract class and an Interface include: An interface can have strictly abs...
Concurrent Collection Classes: Java utility classes are generally useful when used with concurrent programming. This package includes a few small standardized extensible frameworks and some classes that provide proper functionality that is otherwise very difficult to implement. Concurrent Collections: This package supplies Collection implementations mainly used in multithreaded processes. A concurrent collection is always thread-safe , and a single exclusion lock does not govern it. Here are some of the classes below: ConcurrentSkipListMap: Usually preferable to a synchronized TreeMap CopyOnWriteArraySet: Well suited for applications where set sizes generally stay small and read-only operations vastly outnumber mutative operations(add, set, remove, etc.). ConcurrentSkipListSet: This is essentially an equivalent of TreeMap and TreeSet for concurrent code. CopyOnWriteArrayList: It’s preferable over synchronized ArrayList, where an expected number of re...