Map<String,String> resultMap = new LinkedHashMap<>();
map.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(x -> resultMap.put(x.getKey(),(x.getValue())));
comparingByKey():根据key排序.
comparingByValue():根据value排序
map.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(x -> resultMap.put(x.getKey(),(x.getValue())));
comparingByKey():根据key排序.
comparingByValue():根据value排序