Given the code fragment:
public class Foo {
public static void main (String [ ] args) {
Map<Integer, String> unsortMap = new HashMap< > ( );
unsortMap.put (10, "z");
unsortMap.put (5, "b");
unsortMap.put (1, "d");
unsortMap.put (7, "e");
unsortMap.put (50, "j");
Map<Integer, String> treeMap = new TreeMap <Integer, String> (new
Comparator<Integer> ( ) {
@Override public int compare (Integer o1, Integer o2) {return o2.compareTo
(o1); } } );
treeMap.putAll (unsortMap);
for (Map.Entry<Integer, String> entry : treeMap.entrySet () ) {
System.out.print (entry.getValue () + " ");
}
}
}
What is the result?
mvpVN
Highly Voted 5 years, 6 months agoMPignaProTech
Most Recent 1 month, 4 weeks agoDarGrin
7 months, 4 weeks agoasdfjhfgjuaDCV
10 months, 1 week agosteefaand
11 months, 1 week agoduydn
1 year, 3 months agor1muka5
1 year, 10 months agoEden0516
2 years agoMahdiHamdii
2 years agoWilsonKKerll
2 years, 10 months agoThientvse
2 years, 10 months agoYasinGaber
2 years, 11 months agoakitravv
3 years, 8 months agoInnovation
4 years, 12 months agoRitesh_
5 years, 3 months ago