9 Key Interfaces of Collection Framework

     1.Collection :-
    • If we want to represent a group of individual objects as a single entity then we should go for  Collection.
    • Collection interface defines the most common methods which are applicable for any Collection object.
    •  In general  collection interface is considered as root interface of Collection framework.
    • Note:- there is no concrete class which implements collection interface directly.
      2. List :-
    •  List is child interface of Collection.
    • If we want to represent a group of individual objects as a single entity where duplicates are allowed and insertion order preserved then we should go for List.


f             3. Set :-
    • Set is child interface of Collection.
    • If we want to represent a group of individual objects as a single entity where duplicates are not allowed and insertion order are not preserved then we should go for Set.
              4. SortedSet :-
    •  SortedSet is child interface of Set.
    • If we want to represent a group of individual objects as a single entity where duplicates are not allowed but all objects should be inserted according to some sorting order then we should go for SortedSet
              5. NavigableSet :-
    •      It is the child interface of SortedSet.
    •      It defines several methods for navigable purpose.

            


              6Queue:-

    •      It is child interface of Collection.
    •     If we want to represent a group of individual objects prior to processing then we should go for Queue.
    •     Ex: before sending a mail all mail id’s we have to store somewhere and in which order we saved in the same order mail’s should be delivered(First in First out) for this requirement 
    •      Queue concept is the best choice.
                     Note:-

    •       All the above interfaces (Collection, List, Set, SortedSet, NavigableSet and Queue) meant for representing a group of individual objects.
    •       If we want to represent a group of objects as key value pairs the we should go for Map Interface.
             7. Map
    •         Map is not he child interface of Collection.
    •         If we want to represent a group of individual objects as key value pairs then we should    go for Map. Ex : Roll no. Name
          •         102 Shivaji
          •         103 Anil
          •         104 Chandra
    •         Both key and value are objects.
    •         Duplicated keys are not allowed but values can be duplicated.


                         8. SortedMap

              •         It is the child interface of map.
              •         If we want to represent a group of key value pairs according to some sorting order of keys then we should go for SortedMap.



                         9. NavigableMap(I)

              •            It is the child interface of sorted map, it defines
              •            Several utility methods for navigation purpose.
              •            TreeMap is the implementation class for NavigableMap.





            Share:

            No comments:

            Post a Comment

            Quote of the day

            Popular Posts

            Featured Post

            Collection Framework Overview

            Collection:- A collection (sometimes called a container) is simply an object that groups multiple elements into single unit. Collect...

            Youtube Page

            Facebook Page

            Recent Posts

            About

            I am Shivaji Chandra and I'm a Computer Science Engineer. I love to write poems, jokes and quotes. click here →