Table of contents
Collectors.tolist()-> Collects into a ListCollectors.toSet()-> Collects into a SetCollectors.toMap(keyMapper, valueMapper)-> Collects into a MapCollectors.groupingBy(Function)-> Groups elements by a keyCollectors.partitioningBy(Predicate)—> Partitions elements into two groups
(true/false)
List<String> names = List.of("Alice", "Bob", "Charlie");
Map<Integer, List<String>> groupedByLength = names.stream()
.collect(Collectors.groupingBy(String: :length));