示例#1
0
        /// <summary>
        /// Constructs a {@code TerminalOp} that implements a mutable reduce on
        /// reference values.
        /// </summary>
        /// @param <T> the type of the input elements </param>
        /// @param <I> the type of the intermediate reduction result </param>
        /// <param name="collector"> a {@code Collector} defining the reduction </param>
        /// <returns> a {@code ReduceOp} implementing the reduction </returns>
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint:
//ORIGINAL LINE: public static <T, I> TerminalOp<T, I> makeRef(Collector<? base T, I, ?> collector)
        public static TerminalOp <T, I> makeRef <T, I, T1>(Collector <T1> collector)
        {
            Supplier <I> supplier = Objects.RequireNonNull(collector).supplier();
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint:
//ORIGINAL LINE: java.util.function.BiConsumer<I, ? base T> accumulator = collector.accumulator();
//JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
            BiConsumer <I, ?>  accumulator = collector.Accumulator();
            BinaryOperator <I> combiner    = collector.Combiner();

//JAVA TO C# CONVERTER TODO TASK: Local classes are not converted by Java to C# Converter:
//			class ReducingSink extends Box<I> implements AccumulatingSink<T, I, ReducingSink>
            //		{
            //			@@Override public void begin(long size)
            //			{
            //				state = supplier.get();
            //			}
            //
            //			@@Override public void accept(T t)
            //			{
            //				accumulator.accept(state, t);
            //			}
            //
            //			@@Override public void combine(ReducingSink other)
            //			{
            //				state = combiner.apply(state, other.state);
            //			}
            //		}
            return(new ReduceOpAnonymousInnerClassHelper3(collector));
        }