Java Stream
18個の関数
streamcollection.stream()このコレクションをソースとした逐次Streamを返します。
filterstream.filter(predicate)述語に一致する要素で構成されたストリームを返します。
mapstream.map(mapper)各要素に関数を適用したストリームを返します。
flatMapstream.flatMap(mapper)各要素をマップされたストリームの内容に置き換えたストリームを返します。
collectstream.collect(collector)Collectorを使用してミュータブルな縮減を実行します。
forEachstream.forEach(consumer)各エントリに対して指定したアクションを実行します。
reducestream.reduce(identity, accumulator)アキュムレータを使用して要素を縮減します。
sortedstream.sorted(comparator?)要素をソートしたストリームを返します。
distinctstream.distinct()重複した要素を削除したストリームを返します。
limitstream.limit(maxSize)最大maxSize個の要素に制限したストリームを返します。
skipstream.skip(n)最初のn個の要素をスキップしたストリームを返します。
countstream.count()ストリームの要素数を返します。
anyMatchstream.anyMatch(predicate)提供された述語に一致する要素があるかどうかを返します。
allMatchstream.allMatch(predicate)すべての要素が提供された述語に一致するかどうかを返します。
findFirststream.findFirst()最初の要素をOptionalで返します。
Collectors.toListCollectors.toList()要素をListに蓄積するCollectorを返します。
Collectors.joiningCollectors.joining(delimiter, prefix?, suffix?)要素をStringに連結するCollectorを返します。
Collectors.groupingByCollectors.groupingBy(classifier)分類器で要素をグループ化するCollectorを返します。
