list集合取最小(大)值所在位置——java随笔

 private Integer getSrsIpForXrCloud(List ipCountList) {
            //取最小值
            Integer ipCountMin = Collections.min(ipCountList);
            log.info("ipCountMin is {}", ipCountMin);
            //取最大值
            //Integer ipCountMax = Collections.max(ipCountList);
            //取索引
            Integer ipMinIndex = ipCountList.indexOf(ipCountMin);
            log.info("ipMinIndex is {}", ipMinIndex);
            return ipMinIndex;
        }

你可能感兴趣的:(java随笔,java)