A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Sort a Map on the <Key>.
Joined: Mar 02, 2005
Aug 27, 2009 01:31:46
How do we sort a <Map> on the key? I am using a java.util.HashMap.
Joined: Jan 23, 2008
Aug 27, 2009 01:37:57
I think you can use
Joined: Jul 11, 2008
Aug 27, 2009 02:00:44
Dump the HashMap into a TreeMap:
Map hashMap= new HashMap();
Map sortedMap = new TreeMap(hashMap);
I agree. Here's the link:
subject: Sort a Map on the <Key>.
Code to sort and remove duplicates in ArrayList and Hashmap
Sorting values of a Map.
Simplifying list of "time" options with jsp
Why is this called Meaningless Drivel?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014