code: @Nullable
      public <R> R collect(@NotNull Supplier<R> supplier,
                           @NotNull BiConsumer<R, ? super T> accumulator) {
          final R result = supplier.get();
          while (iterator.hasNext()) {
              final T value = iterator.next();
              accumulator.accept(result, value);
          }
          return result;
      }
docs: 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 #collect(com.annimon.stream.Collector)