使用Java 8流创建一个二维列表。

huangapple go评论80阅读模式
英文:

Creating a 2 dimensional list using java 8 streams

问题

我正在尝试在Java中创建一个二维列表。

我首选的第一种方法是这样的:

       List<List<Integer>> seqList = IntStream.range(0, n)
                .mapToObj(ArrayList<Integer>::new)
                .collect(Collectors.toList());

然而,出于某种原因,这种方法花费的时间太长,导致超时。

另一方面,当我尝试使用Java 7来创建二维列表时,没有超时问题。

        List<List<Integer>> seqList = new ArrayList<>();
        for(int i = 0; i < n; i++) {
            seqList.add(new ArrayList<>());
        }
        

我正在尝试尽量使用Java 8的流操作。是否有人可以解释一下为什么我的Java 8代码花费的时间太长,以及我可以采取什么措施使其在与Java 7代码相同的时间复杂度下运行。

英文:

I am trying to create a two dimensional list in java.

My first and preferred method is as so:

       List&lt;List&lt;Integer&gt;&gt; seqList = IntStream.range(0, n)
                .mapToObj(ArrayList&lt;Integer&gt;::new)
                .collect(Collectors.toList());

However, for some reason this method takes too long and I get a timeout.

On the other hand, when I tried to create the two dimensional list using java 7 like so, there was no timeout.

        List&lt;List&lt;Integer&gt;&gt; seqList = new ArrayList&lt;&gt;();
        for(int i = 0; i &lt; n; i++) {
            seqList.add(new ArrayList&lt;&gt;());
        }
        

I am trying to use as much java-8 streams as possible. Could someone explain to me why my java-8 code is taking too long and what I can do to make it run in the same time complexity as the java-7 code.

答案1

得分: 1

多亏了 Jacob G,我得以看到了这个问题。

调用 .mapToObj(ArrayList&lt;Integer&gt;::new) 创建了不同大小的 ArrayList。这等同于 .mapToObj(i -&gt; new ArrayList&lt;Integer&gt;(i))。现在,这意味着在 i 很大时创建新的 ArrayList 对象需要更长的时间,因此导致超时。更好的代码如下:

  List&lt;List&lt;Integer&gt;&gt; seqList2 = IntStream.range(0, n)
                .mapToObj(i -&gt; new ArrayList&lt;Integer&gt;())
                .collect(Collectors.toList());
英文:

Thanks to Jacob G I was able to see the problem.

The call .mapToObj(ArrayList&lt;Integer&gt;::new) was creating ArrayLists of varying size. It was equivalent to .mapToObj(i -&gt; new ArrayList&lt;Integer&gt;(i)). Now this means that creating new arraylist objects when i is huge take longer hence the timeout. The better code is as follows:

  List&lt;List&lt;Integer&gt;&gt; seqList2 = IntStream.range(0, n)
                .mapToObj(i -&gt; new ArrayList&lt;Integer&gt;())
                .collect(Collectors.toList());

答案2

得分: 1

这是另一种方法来完成它。

		int n = 10;
		List<List<Integer>> seqList = Stream.<List<Integer>>generate(() -> new ArrayList<>())
				.limit(n).collect(Collectors.toList());
英文:

This is an alternative way to do it.

		int n = 10;
		List&lt;List&lt;Integer&gt;&gt; seqList =Stream.&lt;List&lt;Integer&gt;&gt;generate(()-&gt;new ArrayList&lt;&gt;())
				.limit(n).collect(Collectors.toList());

</details>



# 答案3
**得分**: 1

以下是您提供的内容的翻译:

```plaintext
流式 API 的相对成本将会很高,即使进行了校正。通过走过许多执行步骤,这一点可以看出。复杂性相当非凡。

以下是来自 IBM Java SE Runtime Environment 版本 1.8 的代码示例:

    // 操作步骤的演示:
    //
    // "通过将 ArrayList 初始化器应用于从 0 到 10 的 'int' 值的流,创建一个列表的列表。"
    
    static {
        List<List<Integer>> seqList = IntStream.range(0, 10)
            .mapToObj(ArrayList<Integer>::new)
            .collect(Collectors.toList());
    }
    
    // 第一步:创建一个 'int' 流。
    //
    // 粗略地说,创建一个 'int' 迭代器,然后将其包装在一个 'int' 流中。
    //
    // 迭代器负责了解迭代范围内的初始和最终值,并提供基本的迭代。
    //
    // 然而,'mapToObj' 是流式 API 的一部分。迭代器必须被放入流中才能访问该 API。
    
    // 'int' 流工厂方法。
    //
    // 扇出到 'RangeIntSpliterator.init' 和 'StreamSupport.intStream'。
    //
    // 'int' 流是以 'parallel' 设置为 false 创建的。
    
    class IntStream {
        public static IntStream range(int startInclusive, int endExclusive) {
            if (startInclusive >= endExclusive) {
                return empty();
            } else {
                return StreamSupport.intStream(
                    new Streams.RangeIntSpliterator(startInclusive, endExclusive, false),
                    false);
            }
        }
    }
    
    // 'int' 迭代器类型。
    //
    // 设置完成后,将使用 'forEachRemaining' 来执行 'int' 迭代。
    
    class RangeIntSpliterator implements Spliterator.OfInt {
        protected int from;
        protected final int upTo;
        protected int last;
    
        RangeIntSpliterator(int from, int upTo, boolean closed) {
            this(from, upTo, (closed ? 1 : 0));
        }
    
        void forEachRemaining(Consumer<? super Integer> action);
        void forEachRemaining(IntConsumer consumer);
    }
    
    // 'int' 流工厂方法。
    //
    // 扇出到 'IntPipeline.Head<>'。'IntPipeline.Head' 扩展了 'IntPipeline',后者扩展了 'AbstractPipeline'。
    //
    // 'IntPipeline.mapToObj' 将 'int' 实例流转换为 'ArrayList' 实例流。
    
    class StreamSupport {
        public static IntStream intStream(Spliterator.OfInt spliterator, boolean parallel) {
            return new IntPipeline.Head<>(
                spliterator,
                StreamOpFlag.fromCharacteristics(spliterator),
                parallel);
        }
    }
    
    class IntPipeLine.Head<> extends IntPipeline<> {
        Head(Spliterator<Integer> source, int sourceFlags, boolean parallel) {
            super(source, sourceFlags, parallel);
        }
    }
    
    class IntPipeline<>
        extends AbstractPipeline<>, Integer, IntStream
        implements IntStream {
    
        IntPipeline(Spliterator<Integer> source, int sourceFlags, boolean parallel) {
            super(source, sourceFlags, parallel);
        }
    
        <U> Stream<U> mapToObj(IntFunction<? extends U> mapper);
    }
    
    class AbstractPipeline {
        AbstractPipeline(Spliterator<?> source, int sourceFlags, boolean parallel) {
            this.previousStage = null;
            this.sourceSpliterator = source;
            this.sourceStage = this;
            this.sourceOrOpFlags = (sourceFlags & StreamOpFlag.STREAM_MASK);
            this.combinedFlags = ((~(sourceOrOpFlags << 1)) & StreamOpFlag.INITIAL_OPS_VALUE);
            this.depth = 0;
            this.parallel = parallel;
        }
    }
    
    // 第二步:通过将 'int' 流与 ArrayList 初始化器组合来创建第二个流。
    //
    // 扇出到 'ReferencePipeline.StatelessOp'。'StatelessOp' 扩展了 'ReferencePipeline',
    // 后者扩展了 'AbstractPipeline'。
    
    class IntPipeline {
        @Override
        public final <U> Stream<U> mapToObj(IntFunction<? extends U> mapper) {
            Objects.requireNonNull(mapper);
            return new ReferencePipeline.StatelessOp<Integer, U>(
                this,
                StreamShape.INT_VALUE,
                (StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT)) {
    
                Sink<Integer> opWrapSink(int flags, Sink<U> sink) {
                    return new Sink.ChainedInt<U>(sink) {
                        public void accept(int t) {
                            downstream.accept(mapper.apply(t));
                        }
                    };
                }
            };
        }
    }
    
    class StatelessOp<E_IN, E_OUT> extends ReferencePipeline<E_IN, E_OUT> {
        StatelessOp(AbstractPipeline<?, E_IN, ?> upstream, StreamShape inputShape, int opFlags) {
            super(upstream, opFlags);
    
            assert upstream.getOutputShape() == inputShape;
        }
    
    // 更多代码...
    
    // 第八步:带着返回值走出。
    
    IntPipeline$4(AbstractPipeline<E_IN,E_OUT,S>).wrapAndCopyInto(S, Spliterator<P_IN>)
      -- 返回一个 'ReducingSink' 实例。
    ReduceOps$3(ReduceOps$ReduceOp<T,R,S>).evaluateSequential(PipelineHelper<T>, Spliterator<P_IN>)
      -- 返回 'ArrayList' 实例。
    IntPipeline$4(AbstractPipeline<E_IN,E_OUT,S>).evaluate(TerminalOp<E_OUT,R>)
      -- 返回 'ArrayList' 实例。
    IntPipeline$4(ReferencePipeline<P_IN,P_OUT>).collect(Collector<? super P_OUT,A,R>)
      -- 返回 'ArrayList' 实例。
    Tester.main

请注意,以上是您提供内容的简单机器翻译,可能存在一些语义和流畅性方面的问题。如果需要更精确和自然的翻译,建议使用专业的人工翻译服务。

英文:

The relative cost of the streaming APIs will be high, even with the correction. This can be seen by walking through the many steps which are performed. The complexity is rather quite extraordinary.

The code examples, below, are from the IBM Java SE Runtime Environment version 1.8.

// A walkthrough of the operation:
//
// &quot;Create a list of lists by collecting the results of applying the ArrayList
// initializer to the stream of &#39;int&#39; values ranging from 0 to 10.&quot;
static {
List&lt;List&lt;Integer&gt;&gt; seqList = IntStream.range(0, 10)
.mapToObj( ArrayList&lt;Integer&gt;::new )
.collect( Collectors.toList() );
}
// First step: Create an &#39;int&#39; Stream.
//
// Roughly, create an &#39;int&#39; iterator, then wrap that in a &#39;int&#39; stream.
//
// The iterator is responsible for knowing the initial and final values
// over the range of iteration, and for providing basic iteration.
//
// However, &#39;mapToObj&#39; is part of the streaming API.  The iterator
// must be put into a stream to access that API.
// The &#39;int&#39; stream factory method.
//
// Fan out to &#39;RangeIntSpliterator.init&#39; and to &#39;StreamSupport.intStream&#39;.
//
// The &#39;int&#39; stream is created with &#39;parallel&#39; set to false.
class IntStream {
public static IntStream range(int startInclusive, int endExclusive) {
if ( startInclusive &gt;= endExclusive ) {
return empty();
} else {
return StreamSupport.intStream(
new Streams.RangeIntSpliterator(startInclusive, endExclusive, false),
false );
}
}
}
// The &#39;int&#39; iterator type.
//
// After setup, &#39;forEachRemaining&#39; will be used to perform
// the &#39;int&#39; iteration.
class RangeIntSpliterator implements Spliterator.OfInt {
protected int from;
protected final int upTo;
protected int last;
RangeIntSpliterator(int from, int upTo, boolean closed) {
this( from, upTo, (closed ? 1 : 0) );
}
void forEachRemaining(Consumer&lt;? super Integer&gt; action);
void forEachRemaining(IntConsumer consumer);
}
// The &#39;int&#39; stream factory method.
//
// Fan out to &#39;IntPipeline.Head&lt;&gt;.init&#39;.  &#39;IntPipeline.Head&#39; extends
// &#39;IntPipeline&#39;, which extends &#39;AbstractPipeline&#39;.
//
// &#39;IntPipeline.mapToObj&#39; creates an stream of &#39;ArrayList&#39; instances
// out of the stream of &#39;int&#39; instances.
class StreamSupport {
public static IntStream intStream(Spliterator.OfInt spliterator, boolean parallel) {
return new IntPipeline.Head&lt;&gt;(
spliterator,
StreamOpFlag.fromCharacteristics(spliterator),
parallel );
}
}
class IntPipeLine.Head&lt;&gt; extends IntPipeline&lt;&gt; {
Head(Spliterator&lt;Integer&gt; source, int sourceFlags, boolean parallel) {
super(source, sourceFlags, parallel);
}
}
class IntPipeline&lt;&gt;
extends AbstractPipeline&lt;, Integer, IntStream&gt;
implements IntStream {
IntPipeline(Spliterator&lt;Integer&gt; source, int sourceFlags, boolean parallel) {
super(source, sourceFlags, parallel);
}
&lt;U&gt; Stream&lt;U&gt; mapToObj(IntFunction&lt;? extends U&gt; mapper);
}
class AbstractPipeline {
AbstractPipeline(Spliterator&lt;?&gt; source, int sourceFlags, boolean parallel) {
this.previousStage = null;
this.sourceSpliterator = source;
this.sourceStage = this;
this.sourceOrOpFlags = ( sourceFlags &amp; StreamOpFlag.STREAM_MASK );
this.combinedFlags = ( (~(sourceOrOpFlags &lt;&lt; 1)) &amp; StreamOpFlag.INITIAL_OPS_VALUE );
this.depth = 0;
this.parallel = parallel;
}
}
// Second step: Create a second stream by composing the &#39;int&#39; stream with the ArrayList
// initializer.
//
// Fan out to &#39;ReferencePipeline.StatelessOp&#39;. &#39;StatelessOp&#39; extends &#39;ReferencePipeline&#39;,
// which extends &#39;AbstractPipeline&#39;.
class IntPipeline {
@Override
public final &lt;U&gt; Stream&lt;U&gt; mapToObj(IntFunction&lt;? extends U&gt; mapper) {
Objects.requireNonNull(mapper);
return new ReferencePipeline.StatelessOp&lt;Integer, U&gt;(
this,
StreamShape.INT_VALUE,
(StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) ) {
Sink&lt;Integer&gt; opWrapSink(int flags, Sink&lt;U&gt; sink) {
return new Sink.ChainedInt&lt;U&gt;(sink) {
public void accept(int t) {
downstream.accept( mapper.apply(t) );
}
};
}
};
}
}
class StatelessOp&lt;E_IN, E_OUT&gt; extends ReferencePipeline&lt;E_IN, E_OUT&gt; {
StatelessOp(AbstractPipeline&lt;?, E_IN, ?&gt; upstream, StreamShape inputShape, int opFlags) {
super(upstream, opFlags);
assert upstream.getOutputShape() == inputShape;
}
abstract class ReferencePipeline&lt;P_IN, P_OUT&gt;
extends AbstractPipeline&lt;P_IN, P_OUT, Stream&lt;P_OUT&gt;&gt;
implements Stream&lt;P_OUT&gt;  {
ReferencePipeline(Supplier&lt;? extends Spliterator&lt;?&gt;&gt; source, int sourceFlags) {
super(source, sourceFlags);
}
}
abstract class AbstractPipeline&lt;E_IN, E_OUT, S extends BaseStream&lt;E_OUT, S&gt;&gt;
extends PipelineHelper&lt;E_OUT&gt; implements BaseStream&lt;E_OUT, S&gt; {
AbstractPipeline(AbstractPipeline&lt;?, E_IN, ?&gt; previousStage, int opFlags) {
if ( previousStage.linkedOrConsumed ) {
throw new IllegalStateException(MSG_STREAM_LINKED);
}
previousStage.linkedOrConsumed = true;
previousStage.nextStage = this;
this.previousStage = previousStage;
this.sourceOrOpFlags = opFlags &amp; StreamOpFlag.OP_MASK;
this.combinedFlags = StreamOpFlag.combineOpFlags(opFlags, previousStage.combinedFlags);
this.sourceStage = previousStage.sourceStage;
if ( opIsStateful() ) {
sourceStage.sourceAnyStateful = true;
}
this.depth = previousStage.depth + 1;
}
}
// Third step: Obtain the collector which is to be used by the &#39;int&#39; stream.
//
// Note use of &#39;CH_ID&#39;, which marks the collector as an &#39;identity finisher&#39;.
class Collectors {
static final Set&lt;Collector.Characteristics&gt; CH_ID =
Collections.unmodifiableSet( EnumSet.of(Collector.Characteristics.IDENTITY_FINISH) );
public static &lt;T&gt; Collector&lt;T, ?, List&lt;T&gt;&gt; toList() {
return new CollectorImpl&lt;&gt;(
(Supplier&lt;List&lt;T&gt;&gt;) ArrayList::new,
List::add,
(left, right) -&gt; { left.addAll(right); return left; },
CH_ID);
}
}
class CollectorImpl&lt;T, A, R&gt; implements Collector&lt;T, A, R&gt; {
private final Supplier&lt;A&gt; supplier;
private final BiConsumer&lt;A, T&gt; accumulator;
private final BinaryOperator&lt;A&gt; combiner;
private final Function&lt;A, R&gt; finisher;
private final Set&lt;Characteristics&gt; characteristics;
CollectorImpl(
Supplier&lt;A&gt; supplier,
BiConsumer&lt;A, T&gt; accumulator,
BinaryOperator&lt;A&gt; combiner,
Function&lt;A,R&gt; finisher,
Set&lt;Characteristics&gt; characteristics) {
this.supplier = supplier;
this.accumulator = accumulator;
this.combiner = combiner;
this.finisher = finisher;
this.characteristics = characteristics;
}
CollectorImpl(
Supplier&lt;A&gt; supplier,
BiConsumer&lt;A, T&gt; accumulator,
BinaryOperator&lt;A&gt; combiner,
Set&lt;Characteristics&gt; characteristics) {
this(supplier, accumulator, combiner, castingIdentity(), characteristics);
}
}
// Fourth step: Start collection.
//
// Push the collector through &#39;ReduceOps.makeRef&#39;.
class ReferencePipeline {
public final &lt;R, A&gt; R collect(Collector&lt;? super P_OUT, A, R&gt; collector) {
A container;
if ( isParallel() &amp;&amp;
(collector.characteristics().contains(Collector.Characteristics.CONCURRENT)) &amp;&amp;
(!isOrdered() ||
collector.characteristics().contains(Collector.Characteristics.UNORDERED))) {
container = collector.supplier().get();
BiConsumer&lt;A, ? super P_OUT&gt; accumulator = collector.accumulator();
forEach(u -&gt; accumulator.accept(container, u));
} else {
container = evaluate( ReduceOps.makeRef(collector) );
}
return collector.characteristics().contains(Collector.Characteristics.IDENTITY_FINISH)
? (R) container
: collector.finisher().apply(container);
}
}
class ReduceOps {
public static &lt;T, I&gt; TerminalOp&lt;T, I&gt; makeRef(Collector&lt;? super T, I, ?&gt; collector) {
Supplier&lt;I&gt; supplier = Objects.requireNonNull(collector).supplier();
BiConsumer&lt;I, ? super T&gt; accumulator = collector.accumulator();
BinaryOperator&lt;I&gt; combiner = collector.combiner();
class ReducingSink extends Box&lt;I&gt; implements AccumulatingSink&lt;T, I, ReducingSink&gt; {
public void begin(long size) {
state = supplier.get();
}
public void accept(T t) {
accumulator.accept(state, t);
}
public void combine(ReducingSink other) {
state = combiner.apply(state, other.state);
}
}
return new ReduceOp&lt;T, I, ReducingSink&gt;(StreamShape.REFERENCE) {
public ReducingSink makeSink() {
return new ReducingSink();
}
};
}
}
class ReduceOp&lt;T, R, S extends AccumulatingSink&lt;T, R, S&gt;&gt; implements TerminalOp&lt;T, R&gt; {
private final StreamShape inputShape;
ReduceOp(StreamShape shape) {
inputShape = shape;
}
}
// Fifth step: Walk into the stream API.
class ReferencePipeline {
&lt;R&gt; R evaluate(TerminalOp&lt;E_OUT, R&gt; terminalOp) {
assert ( getOutputShape() == terminalOp.inputShape() );
if ( linkedOrConsumed ) {
throw new IllegalStateException(MSG_STREAM_LINKED);
}
linkedOrConsumed = true;
return ( isParallel()
? terminalOp.evaluateParallel( this, sourceSpliterator( terminalOp.getOpFlags() ) )
: terminalOp.evaluateSequential( this, sourceSpliterator( terminalOp.getOpFlags() ) ) );
}
}
class AbstractPipeline {
Spliterator&lt;E_OUT&gt; sourceStageSpliterator() {
if ( this != sourceStage ) {
throw new IllegalStateException();
}
if ( linkedOrConsumed ) {
throw new IllegalStateException(MSG_STREAM_LINKED);
}
linkedOrConsumed = true;
if ( sourceStage.sourceSpliterator != null ) {
Spliterator&lt;E_OUT&gt; s = sourceStage.sourceSpliterator;
sourceStage.sourceSpliterator = null;
return s;
} else if ( sourceStage.sourceSupplier != null ) {
Spliterator&lt;E_OUT&gt; s = (Spliterator&lt;E_OUT&gt;) sourceStage.sourceSupplier.get();
sourceStage.sourceSupplier = null;
return s;
} else {
throw new IllegalStateException(MSG_CONSUMED);
}
}
}
class ReduceOp {
public &lt;P_IN&gt; R evaluateSequential(
PipelineHelper&lt;T&gt; helper,
Spliterator&lt;P_IN&gt; spliterator) {
return helper.wrapAndCopyInto( makeSink(), spliterator ).get();
}
}
class AbstractPipeline {
final &lt;P_IN, S extends Sink&lt;E_OUT&gt;&gt; S wrapAndCopyInto(S sink, Spliterator&lt;P_IN&gt; spliterator) {
copyInto( wrapSink( Objects.requireNonNull(sink) ), spliterator );
return sink;
}
}
&lt;P_IN&gt; Sink&lt;P_IN&gt; wrapSink(Sink&lt;E_OUT&gt; sink) {
Objects.requireNonNull(sink);
for (  AbstractPipeline p = AbstractPipeline.this; p.depth &gt; 0; p = p.previousStage ) {
sink = p.opWrapSink( p.previousStage.combinedFlags, sink );
}
return (Sink&lt;P_IN&gt;) sink;
}
class StatelessOp {
Sink&lt;Integer&gt; opWrapSink(int flags, Sink&lt;U&gt; sink) {
return new Sink.ChainedInt&lt;U&gt;(sink) {
public void accept(int t) {
downstream.accept( mapper.apply(t) );
}
};
}
}
// Sixth step: Perform the actual iteration and collection.
//
// Ignoring &#39;begin&#39; and &#39;end&#39;, iteration and collection occurs in the call
// to &#39;forEachRemaining&#39;.
class AbstractPipeline {
&lt;P_IN&gt; void copyInto(Sink&lt;P_IN&gt; wrappedSink, Spliterator&lt;P_IN&gt; spliterator) {
Objects.requireNonNull(wrappedSink);
if ( !StreamOpFlag.SHORT_CIRCUIT.isKnown( getStreamAndOpFlags() ) ) {
wrappedSink.begin( spliterator.getExactSizeIfKnown() );
spliterator.forEachRemaining(wrappedSink);
wrappedSink.end();
} else {
copyIntoWithCancel(wrappedSink, spliterator);
}
}
}
class RangeIntSpliterator implements Spliterator.OfInt {
void forEachRemaining(Consumer&lt;? super Integer&gt; action) {
if ( action instanceof IntConsumer ) {
forEachRemaining((IntConsumer) action);
} else {
if ( Tripwire.ENABLED ) {
Tripwire.trip(getClass(), &quot;{0} calling Spliterator.OfInt.forEachRemaining((IntConsumer) action::accept)&quot;);
forEachRemaining((IntConsumer) action::accept);
}
}
}
void forEachRemaining(IntConsumer consumer) {
Objects.requireNonNull(consumer);
int i = from;
final int hUpTo = upTo;
int hLast = last;
from = upTo;
last = 0;
while ( i &lt; hUpTo ) {
consumer.accept(i++);
}
if ( hLast &gt; 0 ) {
consumer.accept(i);
}
}
}
// Seventh step: For each iteration, unwind and perform the mapping and
// collection operations.
class new Sink.ChainedInt&lt;U&gt;(sink) {
public void accept(int t) {
downstream.accept( mapper.apply(t) );
}
}
class ArrayList {
public ArrayList(int initialCapacity) {
// ...
}
}
class ReducingSink {
public void accept(T t) {
accumulator.accept(state, t);
}
}
class ArrayList {
public boolean add(E e) {
// ...
}
}
// Eigth step: Walking out with the return value.
IntPipeline$4(AbstractPipeline&lt;E_IN,E_OUT,S&gt;).wrapAndCopyInto(S, Spliterator&lt;P_IN&gt;)
-- returns a &#39;ReducingSink&#39; instance.
ReduceOps$3(ReduceOps$ReduceOp&lt;T,R,S&gt;).evaluateSequential(PipelineHelper&lt;T&gt;, Spliterator&lt;P_IN&gt;)
-- returns the &#39;ArrayList&#39; instance.
IntPipeline$4(AbstractPipeline&lt;E_IN,E_OUT,S&gt;).evaluate(TerminalOp&lt;E_OUT,R&gt;)
-- returns the &#39;ArrayList&#39; instance.
IntPipeline$4(ReferencePipeline&lt;P_IN,P_OUT&gt;).collect(Collector&lt;? super P_OUT,A,R&gt;)
-- returns the &#39;ArrayList&#39; instance.
Tester.main

huangapple
  • 本文由 发表于 2020年4月9日 23:55:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/61125185.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定