IntelliJ Java IDE
The moose likes Performance and the fly likes Sort Hashtable by Values & retrive key-value pair Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Performance
Reply Bookmark "Sort Hashtable by Values & retrive key-value pair" Watch "Sort Hashtable by Values & retrive key-value pair" New topic
Author

Sort Hashtable by Values & retrive key-value pair

AMIT ARADHYE
Greenhorn

Joined: Dec 13, 2000
Posts: 15
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

Joined: Apr 20, 2000
Posts: 3252
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
[ January 27, 2003: Message edited by: Peter den Haan ]
 
 
subject: Sort Hashtable by Values & retrive key-value pair
 
Threads others viewed
Sorting a Hashtable by values & retriving kay-value pair
sorting
Sorting HashMap by values
Sorting Hashtable by values & retriving kay-value pair
how to compare elements of List
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture