Wednesday 7 November 2018

Difference between JAVA Collection & Collections


Collection is a root level interface of the Java Collection Framework. Most of the classes in Java Collection Framework implements from this interface. List, Set and Queue are main sub interfaces of this interface. JDK doesn’t provide any direct implementations of this interface. But, JDK provides direct implementations of it’s sub interfaces. ArrayList, Vector, HashSet, LinkedHashSet, PriorityQueue are some indirect implementations of Collection interface. Map interface, which is also a part of java collection framework, doesn’t inherit from Collection interface. Collection interface is a member of java.util package.
Collections is an utility class in java.util package. It consists of only static methods which are used to operate on objects of type Collection. For example, it has the method to find the maximum element in a collection, it has the method to sort the collection, it has the method to search for a particular element in a collection. Below is the list of some important methods of Collections class.
Collections.max()
Collections.min()
Collections.sort()
Collections.synchronizedCollection()



Thanks & Regards:
Trilochan Tarai
9439202111