Java 8 flatMap example - Mkyong.com
mkyong.com › java8 › java-8-flatmap-example4. flatMap example – Order and LineItems This example is similar to the official flatMap JavaDoc example. The orders is a stream of purchase orders, and each purchase order contains a collection of line items, then we can use flatMap to produce a Stream or Stream<LineItem> containing all the line items in all the orders.