Java Streams Intermediate Operations filter() & flatMap()

preview_player
Показать описание
This video describes the Java Streams intermediate operations filter() and flatMap(), which are both stateless, run-to-completion operations. The filter() operation tests a predicate against each element of input stream & returns an output stream containing only elements that match the predicate. The flatMap() operation returns a stream that replaces each element of this stream w/contents of a mapped stream produced by applying the provided mapping function to each element.
Рекомендации по теме
Комментарии
Автор

Thank you. But I still not understand why we need flatMap, the demo is simple and can foreach without flatmap.

firewater