The Collections API is a set of classes and interfaces that support operations on collections of objects.
Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.
Example of interfaces: Collection, Set, List and Map.
Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.
Example of interfaces: Collection, Set, List and Map.
The Collection interface is the root of all collections except maps.
List
The List interface provides support for ordered collections of objects but may
contain duplicate elements.Lists
implement the List interface.
implement the List interface.
Set
A Set stores elements in an unordered way and does not contain duplicate elements.Sets implement the Set
interface.
interface.
Queues
A queue is a collection that orders its elements in a specifi c order for processing.
A typical queue processes its elements in a fi rst - in, fi rst - out (FIFO) fashion, but other
ordering is possible. Queues implement the Queue interface.
A typical queue processes its elements in a fi rst - in, fi rst - out (FIFO) fashion, but other
ordering is possible. Queues implement the Queue interface.
Map
A map is a collection that maps keys to values, with no duplicate keys allowed.
The elements in a map are key - value pairs. Maps implement the Map interface, which is
unique because the Map interface is not a sub interface of Collection like the other types of
collections.
The elements in a map are key - value pairs. Maps implement the Map interface, which is
unique because the Map interface is not a sub interface of Collection like the other types of
collections.