-
Traversing the map
map.forEach((k, v) -> System.out.println("key:value = " + k + ":" + v));
-
map transfer list
map.entrySet().stream().map(e -> new Person(e.getKey(),e.getValue())).collect(Collectors.toList());
-
turn map list
Map<Integer, String> result1 = list.stream().collect( Collectors.toMap(Hosting::getId, Hosting::getName));
java8 achieve traverse map, map rotation list, list turn map
Guess you like
Origin blog.csdn.net/ayoungyeah/article/details/91491680
Recommended
Ranking