‘liusuyi’
2023-06-14 43fc617eb7b94c7e1cc66884cbb9672da8b3bc32
ruoyi-common/src/main/java/com/ruoyi/common/utils/tools/ArdTool.java
@@ -1,8 +1,7 @@
package com.ruoyi.common.utils.tools;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
 * @Description: 工具方法
@@ -35,4 +34,18 @@
        }
        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;
    }
}