@@ -0,0 +1,1050 @@
+package com.winterbe.java8;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.stream.Collectors;%0A%0A/**%0A * @author Benjamin Winterberg%0A */%0Apublic class Streams10 %7B%0A%0A    static class Person %7B%0A        String name;%0A        int age;%0A%0A        Person(String name, int age) %7B%0A            this.name = name;%0A            this.age = age;%0A        %7D%0A%0A        @Override%0A        public String toString() %7B%0A            return name;%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        test1();%0A    %7D%0A%0A    private static void test1() %7B%0A        List%3CPerson%3E persons =%0A            Arrays.asList(%0A                new Person(%22Max%22, 18),%0A                new Person(%22Peter%22, 23),%0A                new Person(%22Brenda%22, 23),%0A                new Person(%22David%22, 12));%0A%0A        Map%3CInteger, List%3CPerson%3E%3E personsByAge = persons%0A            .stream()%0A            .collect(Collectors.groupingBy(p -%3E p.age));%0A%0A        personsByAge%0A            .forEach((age, p) -%3E System.out.format(%22age: %25s; persons: %25s%5Cn%22, age, p));%0A    %7D%0A%0A%7D%0A

Add more stream examples