SortedSet

  • It is the child interface of set.
  • If we want to represent a group of individual object according to some sorting order and duplicates are not allow then we should go for SortedSet.

Methods specified in SortedSet

Basically, there are 6 methods available in SortedSet which are as follows:

  1. first(): it retrieves the first object from a given set of objects.
    For example,

    100
    102
    103
    104
    105
    107

     

    First (); //100

  2. last (); //107


    retrieves the last object;
  3. headset(Object o)
    retrieves one or more than one objects which are less than the specified object.
    e.g.

    headset(107) //[100,102,103,104,105]

  4. tailset(Object o)
    Retrieves one more than one objects which are greater than or equal to specified objects.
    e.g.

    tailset(103); //[103,104,105,107]

  5. subset(Object o1,objecto2)
    Retrieves one or more than one objects which are greater than or equal to Object o1 but less than Objecto2.
  6. comparator() :
    returns comparator objects which describe underlying sorting technique.
Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Projects

SILAN Technology
Call to: 9439202111  |  9658317757  |  0674-2361252

Comment