Home>
Good night, everyone. Seems like a simple task. There is a list of strings. From it you need to get a map, where the key is the next value in the list, the value is the number of repetitions in the sheet. With stream. In fact, it's even a little more complicated there. I wrote the first step, but I still can't do it.
I finished this
List <
String >
strings= List.of ("Java", "JaVA", "PHP", "JS", "java", "jS", "Python", "java");
Map <
String, Long >
result= strings.stream ().
.collect (Collectors.toMap (Function.identity (),
s->
Collections.frequency (strings, s)));
Trends
MapfrequencyMap= strings.stream (). Collect (Collectors.groupingBy (Function.identity (), Collectors.counting ())); tyts
tym321672021-02-26 01:02:49