Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
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:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
Sort a Map on the <Key>.
Rajkamal Pillai
Ranch Hand
Posts: 479
1
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello,
How do we sort a <Map> on the key? I am using a java.util.HashMap.
Thanks,
Raj.
pawan chopra
Ranch Hand
Posts: 419
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I think you can use
TreeMap
Pawan Chopra
SCJP -
itspawan.com
vikram Kesav
Ranch Hand
Posts: 69
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Dump the HashMap into a TreeMap:
Map hashMap= new HashMap();
Map sortedMap = new TreeMap(hashMap);
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Code to sort and remove duplicates in ArrayList and Hashmap
collections query
Sorting values of a Map.
Simplifying list of "time" options with jsp
Why is this called Meaningless Drivel?
More...