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

expecting null as output

 
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why don't following code return null ? since there is no such key named "austin" it should return null.




Output :five ???


Regards
naveen
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So according to the documentation:

Returns the least key greater than or equal to the given key, or null if there is no such key.



The ordering for strings would be the natural ordering, hence the string least greater than "austin" would be "five"
 
naveen yadav
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Mohamed Sanaulla.

so in which case it may return null ?



naveen
 
Marshal
Posts: 25669
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

naveen yadav wrote:so in which case it may return null ?



That was specifically answered in the documentation which Mohamed posted.
 
naveen yadav
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i got it now .

it will return null when





Thanks Mohamed Sanaulla and Paul Clapham.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic