What are the core interfaces in the Collections Framework

Share


A
collection allows a group of objects to be treated as a single unit.
 Java objects can be stored, retrieved, and manipulated as elements of collections. Here’s the ready list of all the core collection interfaces available in Java with their brief description.

Collection Core Interfaces

  • Collection — It’s the root of the collection hierarchy. A basic interface that defines the normal operations that allow a collection of objects to be maintained or handled as a single unit. The Java platform doesn’t provide any direct implementations of this interface but provides implementations of more specific subinterfaces, such as Set and List.
 
  • Set — The Set interface extends the Collection interface and contains a set of unique elements.
 
  • SortedSet — The SortedSet interface extends the Set interface to provide the required functionality for maintaining a set in which the elements are stored in some sorted order.
 
  • List — The List interface extends the Collection interface to maintain a sequence of elements that need not be unique.
 
  • Map — A basic interface that defines operations for maintaining mappings of keys to values. Map cannot contain duplicate keys; each key can map to at most one value
 
  • SortedMap — Extends the Map interface for maps that maintain their mappings sorted in key order.
 
  • Queue — A collection used to hold multiple elements prior to processing. Besides basic Collection operations, a Queue provides additional insertion, extraction, and inspection operations. Queues typically, but do not necessarily, order elements in a FIFO (first-in, first-out) manner. Among the exceptions are priority queues, which order elements according to a supplied comparator or the elements’ natural ordering. Whatever the ordering used, the head of the queue is the element that would be removed by a call to remove or poll. In a FIFO queue, all new elements are inserted at the tail of the queue. Other kinds of queues may use different placement rules. Every Queue implementation must specify its ordering properties.