Junior — Senior
Printing sorted lines using Stream API
livecode
Task condition
It is necessary to understand what output will appear in the console after executing the program, and to correct the code if errors are found.
List<String> animals = List.of("dog", "cat", "parrot");
animals.stream()
.sorted()
.peek(item -> System.out.println(item))
.map(String :: length);
System.out.println(animals);