-
Junior Member
Sorting a hash map based on its keys
hi, can anyone tell me how to sort records in a hashmap based on its keys?
-
Junior Member
Re: Sorting a hash map based on its keys
TreeMap map = new TreeMap(hashMap) takes care or ordering process
-
Expert Member
Re: Sorting a hash map based on its keys
Sorting can be done by placing the hash map on to o tree map (TreeMap is sorted by nature)
Map myMap = new HashMap();
// put keys and values........
Map sortedMap = new TreeMap(myMap);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules