Ads Sponsored By Google :)

Monday 21 January 2013

Classes of Set|SortedSet interface in java Collections|example|tutorial|api|code


SortedSet interface in java Set interface in java SortedSet interface example in java SortedSet interface example  set interface in java collections set interface in java example set interface in java tutorial set interface in collection classes of set interface in java Set interface in java example code Sortedset example in java sortedset api in java SortedSet interface in java collections classes of set interface in java

Set Interface or Java.util.Set.*:

           The interface Set is one of the sub interface of collection interface, so that all the methods of collection are inherited into Set. Even though the methods are same in both collection and Set interface, methods of Collections are defined in some predefined class in such way that duplicate elements are allowed and displayed in random order.
     The methods of Set (which are similar to collection) are defined in some other predefined class in such way that unique elements are allowed and they must be displayed in random order.
        In other words even though methods are same in Collection and Set Interfaces then their implementations are different.
    To know about the methods which are inherited into Set Interface first refer to Collection Interface methods.

Sorted Set Interface or Java.util.SortedSet.* :
    
       In older versions of java also sorted set interface does not contain any special methods except Set methods. Even though Set and SortedSet interfaces methods are same, Set methods are defined in some predefined class in such way that uniqueelements are allowed and they displayed in random order.
    
      Whereas SortedSet methods are defined in some other predefined class in such way that unique elements are allowed and displayed in Sorted order. In other words methods of Set and SortedSet are same their implementations are different in different predefined classes.

In current versions of java, sortedset interface contains five special methods. They are
         
            1)      Public object first()
            2)      Pubic object Last()
            3)      Public SortedSet headset(object obj)
            4)      Public SortedSet SubSet(object obj1,object obj2)
            5)      Public SortedSet tailset(object obj)
        
         The Following diagram illustrate the hierarchy of Abstract classes
Collection Abstract & Concrete Classes



 Data Extraction Interfaces:


          1- D and 2-D Collection Frame work classes are 
  
               To read the values dynamically from keyboard their is a class.
                     
                     Java.util.Scanner or Scanner class

No comments:

Post a Comment

LinkWithin