Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sorting Hashtable by values & retriving kay-value pair  RSS feed

 
AMIT ARADHYE
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All Professionals,
I want to sort two diff. Hashtables by "values".
First Hashtable contains key(String type)- value(String) pairs.
Second Hashtable contains key(String type)- value(Integer) pairs.
FYI I am populating them as...
first.put("20030120",new Integer (56));
first.put("20030118",new Integer (19));
first.put("20030125",new Integer (25));
first.put("20030122",new Integer (32));
first.put("20030117",new Integer (67));
first.put("20030123",new Integer (34));
first.put("20030124",new Integer (42));
first.put("20030121",new Integer (19));
first.put("20030119",new Integer (98));
other ...like this....
second.put("chetooo105","44");
second.put("19tandf127","1");
second.put("18januah140","3");
second.put("Guest79","1");
second.put("18janrout115","1");
second.put("21jantandfnew2152","10");
second.put("19janetailer118","4");
second.put("Au1410113","10");
Can any one guide me to sort these both by values and retrive a kay-value pair from sorted entity?
Thanks
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amit,
That is as may be, but we want to sort different forums by "subject matter". So the idea is that you don't post the very same question in multiple places :roll:
Of the three places where you posted this,Java in General (Intermediate) seems to be spot on. Please follow up there
- Peter
 
AMIT ARADHYE
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I couldn't find any appropriate forum to post this particular question...so done with all three locations to get response.
Hence forth shall try to observe the rules and shall comply with them.
Sorry for in-convinience.
-Amit
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!