Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NavigableSet

 
vendikonda sravan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can some one explain how the fallowing methods of NavigableSet work with an example
"ceiling(E e)","floor(E e)".

Thanks
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from NavigableSet documentation :

floor
E floor(E e)Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.

Parameters:
e - the value to match
Returns:
the greatest element less than or equal to e, or null if there is no such element
Throws:
ClassCastException - if the specified element cannot be compared with the elements currently in the set
NullPointerException - if the specified element is null and this set does not permit null elements

--------------------------------------------------------------------------------

ceiling
E ceiling(E e)Returns the least element in this set greater than or equal to the given element, or null if there is no such element.

Parameters:
e - the value to match
Returns:
the least element greater than or equal to e, or null if there is no such element
Throws:
ClassCastException - if the specified element cannot be compared with the elements currently in the set
NullPointerException - if the specified element is null and this set does not permit null elements


example ? no, give a try

<edit>Hint : TreeSet implements NavigableSet </edit>

hth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic