package org.github.marcellodesales.streams;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.github.marcellodesales.Person;

public class StreamBulkOperationsWithPOJOs {

  public static void main(String[] args) {

    List<Person> list = Arrays.asList(
        new Person("Marcello", "de Sales"),
        new Person("Thiago", "Bruno"),
        new Person("Leandro", "Melo"),
        new Person("Livia", "Maria"));

    // grouping
    System.out.println(
        list.stream()
          .filter(p -> p.getLastName().length() < 7)
          .collect(Collectors.groupingBy(Person::getFirstName)));

  }

}

@@ -320,18 +320,18 @@
 n(%22Marce
-ll
+LL
 o%22, %22de 
@@ -373,13 +373,16 @@
 %22, %22
-Bruno
+de Sales
 %22),%0A
@@ -416,12 +416,16 @@
 %22, %22
-Melo
+de Sales
 %22),%0A
@@ -558,10 +558,11 @@
 .get
-La
+Fir
 stNa
@@ -570,20 +570,21 @@
 e().
-length() %3C 7
+contains(%22L%22)
 )%0A  
@@ -633,19 +633,18 @@
 son::get
-Fir
+La
 stName))

Fixing the example of StringBulkOperationsWithPOJOS to properly group POJOs