Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

NavigableSet, NavigableMap LHCF Methods

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some confusions on this tutorial about NavigableSetand NavigableMap.

Actually it's just the floor and the ceiling that's confusing me. They always seem to produce the parameter as the result.

NavigableSet:
Any
George
Hydro
Martin
Wallace

ceiling(Hydro) == Hydro.
floor(Hydro) == Hydro.


If we're talking about Strings in the Set, does ceiling and floor will always produce the same result as the parameter passed? I would like to know when will the results be different.

NavigableMap:
{5.64, Wallace}
{7.25, George}
{8.09, Hydro}
{9.00, Any}
{10.00, Martin}

ceilingKey(9.00) == 9.0
floorKey(9.00) == 9.0


Do you know any other resources with other examples for these particular methods? Thank you in advance!
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




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


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



source:http://java.sun.com/javase/6/docs/api/java/util/NavigableSet.html

hope this helps
 
    Bookmark Topic Watch Topic
  • New Topic