
It uses binary search algorithm internally.

It is used to search the specified element in the given collection. It is used to get the maximum element in the specified collection. It is used to get the minimum element in the specified collection. It is used to sort the elements in the specified collection. Syntax: public class Collections extends ObjectĬollections Class Methods Collections.sort() It consists of polymorphic algorithms that operate on collections, “wrappers”, which in turn return a new collection backed by a specified collection. It contains exclusively static methods that operate on or return collections. It returns true if one or more element present the collection otherwise returns false.Ĭollections class in java represents an utility class in java.util package. It is used to check whether the specified collection contains any element or not. It is used to remove the all elements from the specified collection.

It is used to get the number of elements in the specified collection. It is used to remove the existing element from the specified collection. It is used to add the new element in the specified collection. Syntax: public interface Collection extends Iterable Collection Interface Methods add() Map interface is also part of Java collection framework but it does not inherit the Collection interface.

List, Set and Queue are immediate sub interfaces of Collection interface. It contains the core methods for all collections. CollectionĬollection interface represents the root interface in the collection hierarchy. Both (Collection and Collections) are added to jdk in java version 1.2īesides these similarities, they have few differences also.Both (Collection and Collections) are present in java.util package.Both (Collection and Collections) are part of the Java Collections Framework.
