Sample code to retrieve objects from HashMap in sorted
ascending order?
Answer Posted / 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 |
Post New Answer View All Answers
What do you mean by chromounits in java8?
What are inbuilt functions?
What are advantages and disadvantages of OOPs?
Explain the difference between serializable and externalizable in java?
Can a static class implement an interface?
When to use runnable interface vs thread class in java?
What is the purpose of a volatile variable?
Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.
Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.
what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread
What advantage do java's layout managers provide over traditional windowing systems?
What is n in java?
Define jre i.e. Java runtime environment?
What is mean by exception?
What is stringjoiner ?