The Collection interface is the root interface in the Java collection hierarchy. A collection represents a group of objects, called elements. This interface is used to pass collections around and manipulate them where general processing is required. The main collection interfaces in the Java collection framework are as follows.
All the interfaces are in java.util package. We can import them into your program as:
A Set is a collection that contains no duplicate elements. We can use the Set collection when the objects in the collection do not contain duplicates for example playing cards.
public interface Set<E> extends Collection<E>
A List is an ordered collection also known as a sequence. Unlike Set, the list can contain duplicate elements in the collection.
public interface List<E> extends Collection<E>
A Queue collection is designed for holding elements prior to processing with some operations.
public interface Queue<E> extends Collection<E>
A Map is used to map keys to values. A map cannot contain duplicate keys; and each key can map to at most one value.
public interface Map<K, V>
Java Tutorial on this website:
For more information on Java, visit the official website :