The first flavor accepts a single BinaryOperator parameter. A BinaryOperator<T> accepts two parameters of type T , and combines them together to return a T . Note that because the starting stream might be empty, the method returns an Optional<T> .

The second flavor is similar to the first one, but requires a starting value. For this reason, the return type is not an Optional<T> but a T . If the stream is empty, the result will be the starting value. If it isn’t, it should be the same as with the previous flavor, provided the starting value is the neutral element for the reduction function.