Java 8 lambdas group list into map

Use the simple groupingBy variant:

Map<String, List<Pojo>> map = pojos
  .stream()
  .collect(
     Collectors.groupingBy(Pojo::getKey)
  );

Leave a Comment