我创建一个Map从List如下:
List<String> strings = Arrays.asList("a", "bb", "ccc");
Map<String, Integer> map = strings.stream()
.collect(Collectors.toMap(Function.identity(), String::length));
Run Code Online (Sandbox Code Playgroud)
我希望保持与之相同的迭代顺序List.如何创建LinkedHashMap使用Collectors.toMap()方法?