Using Collectors.groupingBy() with Collectors.collectingAndThen() is a handy way to transform a list into a map.
In this example, collectingAndThen() computes each map entry's value by passing a group of list elements to a function.
In this example, collectingAndThen() computes each map entry's value by passing a group of list elements to a function.
Comments
https://buff.ly/43afI2I