java.util.Collection#stream
default Stream<E> stream() {
return StreamSupport.stream(spliterator(), false);
}
java.util.stream.StreamSupport#stream(java.util.Spliterator<T>, boolean)
java.util.stream.AbstractPipeline#AbstractPipeline(java.util.Spliterator<?>, int, boolean)
java.util.stream.ReferencePipeline#filter
java.util.stream.AbstractPipeline#AbstractPipeline(java.util.stream.AbstractPipeline<?,E_IN,?>, int)
java.util.stream.ReferencePipeline#map
java.util.stream.AbstractPipeline#AbstractPipeline(java.util.stream.AbstractPipeline<?,E_IN,?>, int)
java.util.stream.ReferencePipeline#collect(java.util.stream.Collector<? super P_OUT,A,R>)
java.util.stream.AbstractPipeline#evaluate(java.util.stream.TerminalOp<E_OUT,R>)
java.util.stream.ReduceOps.ReduceOp#evaluateSequential
java.util.stream.AbstractPipeline#wrapSink
//
java.util.stream.AbstractPipeline#copyInto
spliterator.forEachRemaining(wrappedSink);--执行access
java.util.ArrayList.ArrayListSpliterator#forEachRemaining
流处理和非流处理的区别:
流就好比一两条流水线,一条流水线里有很多操作。
如果是非流就是每个操作是一个流水线,几个操作就几个流水线,时间多了n个操作的倍数。
流和并行流:jdk8的并行流少用,对操作的封装有冗余(浪费了大部分时间)。