| Author |
NavigableSet
|
vendikonda sravan
Ranch Hand
Joined: May 09, 2010
Posts: 38
|
|
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
Joined: Jan 28, 2008
Posts: 5575
|
|
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
|
 |
 |
|
|
subject: NavigableSet
|
|
|