Can you explain the core collection interfaces?

There are six interfaces and come under two different inheritance group one which comes under the collection interface root and the other in the map interface root.

 

Collection

It’s the base of all collection classes. It provides a unified way to manipulate collection objects. Collection has group of object called as elements. These elements can be accessed and manipulated using Iterator. List

In List interface the elements are arranged sequentially. Elements can be inserted in to any location and you can also insert duplicate elements. In order to access the elements you need to use the “ListIterator”. Using “ListIterator” you can move back and forth which makes it unique as compared to other iterators.

 

Set

It represents a collection but no duplicates are allowed in this case.

 

SortedSet

It extends the Set interface and sorts the set in ascending order.

 

Map

Map stores association between keys and value pairs. So given a key you can easily find the value. One thing important to note is they do not implement iterable interface. But yes you can obtain a collection view of the map which allows you loop using for loop.

 

SortedMap

It extends Map so that the keys are maintained in ascending order.