Answers for "how to find min value in map"

1

Min value map

Map -- Min value
Write a method that can return the minimum value from ta map
(DO NOT use sort method)
 
Solution: 
public  static  int  minValue( Map<String,Integer>    map  ) {
        SortedSet<Integer> sm = new TreeSet<>(map.values());
        return sm.first( );
}
Posted by: Guest on September-29-2021
0

Min value map

Map<String, Double> map = new HashMap<String, Double>();
map.put("1.1", 1.1);
map.put("0.1", 0.1);
map.put("2.1", 2.1);

Double min = Collections.min(map.values());
System.out.println(min); // 0.1
Posted by: Guest on March-23-2022

Code answers related to "how to find min value in map"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language