Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Map Interface on SCJP

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have heard conflicting info so I came to JavaRanch to pose the question. Now I know Map basically map Keys to Values(No dups allowed) but are Maps actually sorted?
I didn't think so because they also have a SortedMap interface but I just wanted to be sure as the Exam approaches.
Regards,
Travis M. Gibson
(Future SCJP - Nov 19, 2000)
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Keys will be unique, Values need not. 2 unique keys can have a same value
Aruna
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi:
SortedMap interface extends Map interface and maintains the mappings in key order (sorted on keys).
Check out http://www.javaprepare.com/notes/collectn.html for a good info on Collections.
HTH
 
Travis Gibson
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot fellow ranchers.
I had just finished researching the question. In fact in writing the code answered my own question. I remembered that the Map interface is extended by the SortedMap interface which in turn is implemented by TreeMap.
Code is the best teacher,
Travis M. Gibson
(Future SCJP - Nov. 19, 2000)
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic