Ordering HashMap values

Reply

Join Date: Jul 2007
Posts: 8
Reputation: spider_pig is an unknown quantity at this point 
Solved Threads: 1
spider_pig spider_pig is offline Offline
Newbie Poster

Ordering HashMap values

 
0
  #1
Nov 16th, 2007
I have a Java HashMap with String keys and Integer values. I need to produce a string which has the keys in the same order as their corresponding values sorted by numerically descending order. What are my options?
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Ordering HashMap values

 
0
  #2
Nov 16th, 2007
your options are to not use a HashMap. HashMap is not sorted.
You may try a TreeMap, but that's sorted on key only.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC