| | |
| | | package com.ruoyi.common.utils.tools; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: 工具方法 |
| | |
| | | } |
| | | return map; |
| | | } |
| | | /** |
| | | * 求Map<K,V>中最小 Value 对应的Key值 |
| | | * |
| | | * @param map |
| | | * @return |
| | | */ |
| | | public static String getKeyByMinValue(Map<String, Double> map) { |
| | | if (map == null) return null; |
| | | List<Map.Entry<String, Double>> list = new ArrayList(map.entrySet()); |
| | | Collections.sort(list, (o1, o2) -> (o1.getValue().intValue() - o2.getValue().intValue())); |
| | | String min = list.get(0).getKey(); |
| | | // String max = list.get(list.size() - 1).getKey(); |
| | | return min; |
| | | } |
| | | } |