Archive For 21. November 2016

Grouping Items with Java 8 Streams

By |

Grouping Items with Java 8 Streams

This small example demonstrates the usage of Collectors.groupingBy to group a list of Persons by their age. The mapped result is a map of list with all Persons of the same age. public class Person { private Integer age; private String name; public Person(Integer age, String name) { this.age = age; this.name = name; }…

Read more »