将需要排序的map集合替换(用*标注的map),最后结果为hashMap
LinkedHashMap<String, String> collect = *map*.entrySet().stream().sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oleValue, newValue) -> oleValue,
LinkedHashMap::new));
LinkedHashMap<String, List<KVPair>> hashMap = new LinkedHashMap<String, List<KVPair>>();
*map*.entrySet().stream().sorted(Map.Entry.comparingByKey())
.forEachOrdered(x -> hashMap.put(x.getKey(), x.getValue()));
//