@Nullable
    public <R> R collect(@NotNull Supplier<R> supplier,
                         @NotNull ObjLongConsumer<R> accumulator) {
        final R result = supplier.get();
        while (iterator.hasNext()) {
            final long value = iterator.nextLong();
            accumulator.accept(result, value);
        }
        return result;
    }
@ Nullable public < R > R collect ( @ NotNull Supplier < R > supplier , @ NotNull ObjLongConsumer < R > accumulator ) { final R result = supplier . get ( ) ; while ( iterator . hasNext ( ) ) { final long value = iterator . nextLong ( ) ; accumulator . accept ( result , value ) ; } return result ; }
Collects elements to {@code supplier} provided container by applying the given accumulation function.

<p>This is a terminal operation.

@param <R> the type of the result
@param supplier  the supplier function that provides container
@param accumulator  the accumulation function
@return the result of collect elements
@see Stream#collect(com.annimon.stream.function.Supplier, com.annimon.stream.function.BiConsumer)