public Optional<T> foldLeft(BinaryOperator<T> accumulator) {
        Box<T> result = new Box<>(none());
        forEachOrdered(t -> result.a = result.a == NONE ? t : accumulator.apply(result.a, t));
        return result.a == NONE ? Optional.empty() : Optional.of(result.a);
    }
public Optional < T > foldLeft ( BinaryOperator < T > accumulator ) { Box < T > result = new Box < > ( none ( ) ) ; forEachOrdered ( t -> result . a = result . a == NONE ? t : accumulator . apply ( result . a , t ) ) ; return result . a == NONE ? Optional . empty ( ) : Optional . of ( result . a ) ; }
Folds the elements of this stream using the provided accumulation
function, going left to right. This is equivalent to:

<pre>
{@code
boolean foundAny = false;
T result = null;
for (T element : this stream) {
if (!foundAny) {
foundAny = true;
result = element;
}
else
result = accumulator.apply(result, element);
}
return foundAny ? Optional.of(result) : Optional.empty();
}
</pre>

<p>
This is a terminal operation.

<p>
This method cannot take all the advantages of parallel streams as it must
process elements strictly left to right. If your accumulator function is
associative, consider using {@link #reduce(BinaryOperator)} method.

<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.

@param accumulator a <a
href="package-summary.html#NonInterference">non-interfering </a>,
<a href="package-summary.html#Statelessness">stateless</a>
function for incorporating an additional element into a result
@return the result of the folding
@see #foldLeft(Object, BiFunction)
@see #foldRight(BinaryOperator)
@see #reduce(BinaryOperator)
@since 0.4.0