P E N C I L
Login
Java8 Stream
References
Stream + Collection
Stream:
  1. .map(String::toUpperase)
  2. .filter(Objects::nonNull)
  3. .flatMap()
  4. reduce((a,b)=> a+b).get()
  5. .of(1,2,3)
  6. .forEach()

  7. .collect(Collectors.toList())
  8. .flatMap(o -> o.stream())
  9. ,max((o1, o2) -> o1-o2).get()
    .max(Comparator.comparing(Person::getAge))
  10. .mapToInt() -> IntStream
  11. groupingBy(o->b);

IntStream
  1. summaryStatistics()

Collector
  1. .collect(Collectors.partitionBy(o->boolean)) => Map
  2. .collect(Collectors.groupingBy(o->key) => Map<key, list<value)
  3. .collect(Collectors.joining(delim)) => Join string
  4. .collect(Collectors.toMap(keyFunc, Function.identity())) => Map<key, value)
    If key is duplicated, throw exception

Optional<> x;
  1. x.isPresent()
    x.get()