954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Ordered String from a HashMap

I have a HashMap with String keys and Integer values.
I want to get a string with the String keys in numerical order of their String values.
eg. if I have
Orange=1 apple=4 pear =2 grapefruit=3
I want the following String
apple, pear, grapefruit, orange.
I'm not sure how to do this. Any help would be much appreciated.

spider_pig
Newbie Poster
8 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
 

you can't. Map's aren't sorted.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You