Given below the sample code :
4. HashMap hm = new HashMap();
5. hm.put("key45", "some value");
6. hm.put("key12", "some other value");
7. hm.put("key39", "yet another value");
8. Set a = hm.keySet();
9. // insert code here
What code should be at line 9 to sort the keys in HashMap "hm"?
1. a = new SortedSet(a) ;
2. Collections.sort(a);
3. a = new TreeSet(a);
4. a = Collections.sort(a);
(3)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.