Sample code to retrieve objects from HashMap in sorted
ascending order?

Answers were Sorted based on User's Feedback



Sample code to retrieve objects from HashMap in sorted ascending order?..

Answer / murli

Map hm = new HashMap();
//add values to hashmap
Map tm = new TreeMap(hm);
//Iterate keySet in tm

Is This Answer Correct ?    9 Yes 2 No

Sample code to retrieve objects from HashMap in sorted ascending order?..

Answer / amit badgujar

Yes it is correct

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

Is linked list a linear or non-linear data structure?

0 Answers   Akamai Technologies,


Can singleton class be cloned?

0 Answers  


why should we get the following error ? Exception in main method NoClassDefFoundError:classname could anyone give the detail clarification on how java compiler can look for .class file?

2 Answers  


Why parsing is done?

0 Answers  


What is collection sort in java?

0 Answers  






What is the difference between length and length() method in java?

0 Answers  


What are the differences between path and classpath variables?

0 Answers  


What are the disadvantages of object oriented programming?

0 Answers  


how to pass the parameters to applets?

1 Answers  


How can a gui component handle its own events in java programming?

0 Answers  


Why do we use variables?

0 Answers  


Can we add default constructor to Servlet?

1 Answers   Fidelity,


Categories