Example:
// = "123"
Stream.of("1", "2", "3").fold("", (a1, a2) -> a1 + a2);
| Modifier and Type | Method and Description |
|---|---|
| public default T | Returns: a folded valueA zero element to start with. zero, BiFunction<? super T, ? super T, ? extends T> A function which combines elements. combine)Folds this elements using the given associative binary operator, starting with |
| public < the type to fold over U> U | Returns: a folded valueA zero element to start with. zero, BiFunction<? super U, ? super T, ? extends U> A function which combines elements. combine)Folds this elements from the left, starting with |
| public < the type of the folded value U> U | Returns: a folded valueA zero element to start with. zero, BiFunction<? super T, ? super U, ? extends U> A function which combines elements. combine)Folds this elements from the right, starting with |
| public default T | Returns: the reduced value.A BiFunction of type T op)Accumulates the elements of this Foldable by successively calling the given operation |
| public T | Returns: the reduced value.A BiFunction of type T op)Accumulates the elements of this Foldable by successively calling the given operation |
| public Option | Returns: Some of reduced value or None if the Foldable is empty.A BiFunction of type T op)Accumulates the elements of this Foldable by successively calling the given operation |
| public default Option | Returns: Some of reduced value or None if the Foldable is empty.A BiFunction of type T op)Accumulates the elements of this Foldable by successively calling the given operation |
| public T | Returns: the reduced value.An operation of type T op)Accumulates the elements of this Foldable by successively calling the given operation |
| public Option | Returns: Some of reduced value or None.An operation of type T op)Accumulates the elements of this Foldable by successively calling the given operation |
| fold | back to summary |
|---|---|
| public default T fold(T zero, BiFunction<? super T, ? super T, ? extends T> combine) Folds this elements using the given associative binary operator, starting with
The methods
| |
| foldLeft | back to summary |
|---|---|
| public <U> U foldLeft(U zero, BiFunction<? super U, ? super T, ? extends U> combine) Folds this elements from the left, starting with Example:
| |
| foldRight | back to summary |
|---|---|
| public <U> U foldRight(U zero, BiFunction<? super T, ? super U, ? extends U> combine) Folds this elements from the right, starting with Example:
| |
| reduce | back to summary |
|---|---|
| public default T reduce(BiFunction<? super T, ? super T, ? extends T> op) Accumulates the elements of this Foldable by successively calling the given operation
| |
| reduceLeft | back to summary |
|---|---|
| public T reduceLeft(BiFunction<? super T, ? super T, ? extends T> op) Accumulates the elements of this Foldable by successively calling the given operation
| |
| reduceLeftOption | back to summary |
|---|---|
| public Option Accumulates the elements of this Foldable by successively calling the given operation
| |
| reduceOption | back to summary |
|---|---|
| public default Option Accumulates the elements of this Foldable by successively calling the given operation
| |
| reduceRight | back to summary |
|---|---|
| public T reduceRight(BiFunction<? super T, ? super T, ? extends T> op) Accumulates the elements of this Foldable by successively calling the given operation
| |
| reduceRightOption | back to summary |
|---|---|
| public Option Accumulates the elements of this Foldable by successively calling the given operation
| |