Solutionunvalidated
Make sure you have 'distinct' values: — List.of("a", "b", "a"); Map map = list.stream(). Outcome: Map map = list.stream() .distinct() .collect(Collectors.toMap(s -> s, String::length));.
2fb49ad8-1600-44d2-8bb0-6b3b8f6bc173
Make sure you have 'distinct' values: — List.of("a", "b", "a"); Map map = list.stream(). Outcome: Map map = list.stream() .distinct() .collect(Collectors.toMap(s -> s, String::length));.