This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes NavigableSet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "NavigableSet" Watch "NavigableSet" New topic
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: NavigableSet
 
Similar Threads
Excel Match equivalent in java.
Generics - Unchecked conversion warning
Subset doubt
Declaring Open/Closed/Semi-Open intervals in subSet() - SortedSet
navigable set and sorted set