File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes NavigableSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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://aspose.com/file-tools
 
subject: NavigableSet
 
Similar Threads
Declaring Open/Closed/Semi-Open intervals in subSet() - SortedSet
Excel Match equivalent in java.
Generics - Unchecked conversion warning
navigable set and sorted set
Subset doubt