Stream.flatMap
, as it can be guessed by its name, is the combination of a map
and a flat
operation. That means that you first apply a function to your elements, and then flatten it. Stream.map
only applies a function to the stream without flattening the stream.
To understand what flattening a stream consists in, consider a structure like [ [1,2,3],[4,5,6],[7,8,9] ]
which has "two levels". Flattening this means transforming it in a "one level" structure : [ 1,2,3,4,5,6,7,8,9 ]
.
아, 설명이 자바 8 ..;;
출처 : http://stackoverflow.com/questions/26684562/whats-the-difference-between-map-and-flatmap-methods-in-java-8
'개발 > PYTHON' 카테고리의 다른 글
python 웹크롤링 (0) | 2017.06.28 |
---|---|
print newline 넘어가지 않게 ... (0) | 2017.02.15 |
random 하게 list data split (0) | 2017.01.31 |
reload (0) | 2017.01.31 |
python list filtering 방법 (0) | 2017.01.25 |
댓글