Forums Register Login

Sorting Hashtable by values & retriving kay-value pair

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
You had your fun. Now it's time to go to jail. Thanks for your help tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1110 times.
Similar Threads
how to compare elements of List
sorting
Sorting HashMap by values
Sort Hashtable by Values & retrive key-value pair
How to sort a list of things (string, float)?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 02:44:20.