This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Sorting MAP by values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Sorting MAP by values

Waez Ali
Ranch Hand

Joined: Jan 24, 2005
Posts: 43
posted Today 1:50 PM
--------------------------------------------------------------------------------
Hi,

I am opening this again with specific question.

I am reading some data from properties file, & need to sort the map by values.

E.g test.properties

1 = Hi
2 = hello
3 = Bye
4 = Thank You
5 = Thank You
6 = Bye

I tried with following




Problem with this code is it overrides the duplicate values.

Is there any other way I can sort the data, please suggest.

Thanks in advance.
Waez Ali.
[ July 21, 2008: Message edited by: Waez Ali ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Your original question was moved here. Please continue any discussion there, rather than starting a new topic.
[ July 21, 2008: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sorting MAP by values
 
Similar Threads
Sorting MAP
How to sort a Map with Enums
sorting hashmap based on values
displaytag help, sorting map objects
Retrieving different keys when the values in a hashmap are same???