Basic Knowledge of Collection Framewrok
Class Hierarchy Of Collection Framework:
Difference about List,Queue,Set,Map interface:
The entire collection framework is divided into four interfaces.
List —> It handles sequential list of objects. ArrayList, Vector and LinkedList classes implement this interface.
Queue —> It handles special list of objects in which elements are removed only from the head. LinkedList and PriorityQueue classes implement this interface.
Set —> It handles list of objects which must contain unique element. This interface is implemented by HashSet and LinkedHashSet classes and extended by SortedSet interface which in turn, is implemented by TreeSet.
Map —> This is the one interface in Collection Framework which is not inherited from Collection interface. It handles group of objects as Key/Value pairs. It is implemented by HashMap and HashTable classes and extended by SortedMap interface which in turn is implemented by TreeMap.
Three of the above interfaces (List, Queue, and Set) inherit from the Collection interface. Although Map is included in the collection framework it does not inherit from the Collection interface.
Collection interface method
The collection interface contains total 15 abstract methods. 14 of it’s own and one is inherited from Iterable interface. Here is the list and descriptions of those methods.
equals() and hashcode() methods in the Collection interface are not the methods of java.lang.Object class. Because, interfaces does not inherit from Object class. Only classes in java are sub classes of Object class. Any classes implementing Collection interface
must provide their own version of equals() and hashcode() methodsor they can retain default version
inherited from Object class.