Monday, 20 April 2020

SE - 61 - Collection Vs Collections

Collection is an interface and Collections is a class but both comes under Collection framework. Many of the classes of Java Collection Framework inherits Collection.

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. Few of the examples of Collections class methods are :

synchronizedCollection() - It is used to get a synchronized (thread-safe) collection backed by the specified collection.

addAll() - It is used to adds all of the specified elements to the specified collection.


sort() - Used to sort a given collection


copy() - It is used to copy all the elements from one list into another list.


No comments:

Post a Comment