/** * map 按 key 升序排序 * * @param map * @return */ private Map<String, Object> sortByKey(Map<String, Object> map) { Map<String, Object> result = new LinkedHashMap<>(map.size()); map.entrySet().stream() .sorted(Map.Entry.comparingByKey()) .forEachOrdered(e -> result.put(e.getKey(), e.getValue())); return result; }
结束