Most visited

Recently visited

Added in API level 24

StreamSupport

public final class StreamSupport
extends Object

java.lang.Object
   ↳ java.util.stream.StreamSupport


用于创建和操作流的低级实用程序方法。

该类主要用于呈现数据结构的流视图的库作者; 大多数用于最终用户的静态流方法都在各种Stream类中。

Summary

Public methods

static DoubleStream doubleStream(Spliterator.OfDouble spliterator, boolean parallel)

创建一个新的串行或并行 DoubleStreamSpliterator.OfDouble

static DoubleStream doubleStream(Supplier<? extends Spliterator.OfDouble> supplier, int characteristics, boolean parallel)

创建一个新的顺序或并行 DoubleStreamSupplierSpliterator.OfDouble

static IntStream intStream(Spliterator.OfInt spliterator, boolean parallel)

创建一个新的串行或并行 IntStreamSpliterator.OfInt

static IntStream intStream(Supplier<? extends Spliterator.OfInt> supplier, int characteristics, boolean parallel)

创建一个新的顺序或并行 IntStreamSupplierSpliterator.OfInt

static LongStream longStream(Spliterator.OfLong spliterator, boolean parallel)

创建一个新的串行或并行 LongStreamSpliterator.OfLong

static LongStream longStream(Supplier<? extends Spliterator.OfLong> supplier, int characteristics, boolean parallel)

创建一个新的顺序或并行 LongStreamSupplierSpliterator.OfLong

static <T> Stream<T> stream(Spliterator<T> spliterator, boolean parallel)

创建一个新的串行或并行 StreamSpliterator

static <T> Stream<T> stream(Supplier<? extends Spliterator<T>> supplier, int characteristics, boolean parallel)

创建一个新的顺序或并行 StreamSupplierSpliterator

Inherited methods

From class java.lang.Object

Public methods

doubleStream

Added in API level 24
DoubleStream doubleStream (Spliterator.OfDouble spliterator, 
                boolean parallel)

创建一个新的串行或并行 DoubleStreamSpliterator.OfDouble

在流管道的终端操作开始之后,分裂器仅被估计大小的遍历,拆分或查询。

强烈建议分割器报告IMMUTABLECONCURRENT的特征,或者late-binding 否则,应该使用doubleStream(java.util.function.Supplier, int, boolean)来减少潜在干扰源的范围。 有关更多详细信息,请参阅Non-Interference

Parameters
spliterator Spliterator.OfDouble: A Spliterator.OfDouble describing the stream elements
parallel boolean: if true then the returned stream is a parallel stream; if false the returned stream is a sequential stream.
Returns
DoubleStream a new sequential or parallel DoubleStream

doubleStream

Added in API level 24
DoubleStream doubleStream (Supplier<? extends Spliterator.OfDouble> supplier, 
                int characteristics, 
                boolean parallel)

创建一个新的顺序或并行 DoubleStreamSupplierSpliterator.OfDouble

get()方法将在供应商上调用不超过一次,并且仅在流管道的终端操作开始之后。

该报告的特性spliterators IMMUTABLE或者 CONCURRENT ,或者是 late-binding ,很可能更有效地使用 doubleStream(java.util.Spliterator.OfDouble, boolean)代替。

以这种形式使用Supplier提供了间接的级别,从而减少了对源的潜在干扰的范围。 由于只在终端操作开始后调用供应商,所以直到终端操作开始时对源的任何修改都会反映在流结果中。 有关更多详细信息,请参阅Non-Interference

Parameters
supplier Supplier: A Supplier of a Spliterator.OfDouble
characteristics int: Spliterator characteristics of the supplied Spliterator.OfDouble. The characteristics must be equal to supplier.get().characteristics(), otherwise undefined behavior may occur when terminal operation commences.
parallel boolean: if true then the returned stream is a parallel stream; if false the returned stream is a sequential stream.
Returns
DoubleStream a new sequential or parallel DoubleStream

也可以看看:

intStream

Added in API level 24
IntStream intStream (Spliterator.OfInt spliterator, 
                boolean parallel)

创建一个新的串行或并行 IntStreamSpliterator.OfInt

在流管道的终端操作开始之后,分裂器仅被估计大小的遍历,拆分或查询。

强烈建议分割器报告IMMUTABLECONCURRENT的特征,或者late-binding 否则,应该使用intStream(java.util.function.Supplier, int, boolean)来减少潜在干扰源的范围。 有关更多详细信息,请参阅Non-Interference

Parameters
spliterator Spliterator.OfInt: a Spliterator.OfInt describing the stream elements
parallel boolean: if true then the returned stream is a parallel stream; if false the returned stream is a sequential stream.
Returns
IntStream a new sequential or parallel IntStream

intStream

Added in API level 24
IntStream intStream (Supplier<? extends Spliterator.OfInt> supplier, 
                int characteristics, 
                boolean parallel)

创建一个新的顺序或并行 IntStreamSupplierSpliterator.OfInt

get()方法将在供应商上被调用不超过一次,并且仅在流管线的终端操作开始之后。

该报告的特性spliterators IMMUTABLE或者 CONCURRENT ,或者是 late-binding ,很可能更有效地使用 intStream(java.util.Spliterator.OfInt, boolean)代替。

以这种形式使用Supplier提供了一个间接级别,可以减少潜在干扰源的范围。 由于只在终端操作开始后调用供应商,所以直到终端操作开始时对源的任何修改都会反映在流结果中。 详情请参阅Non-Interference

Parameters
supplier Supplier: a Supplier of a Spliterator.OfInt
characteristics int: Spliterator characteristics of the supplied Spliterator.OfInt. The characteristics must be equal to supplier.get().characteristics(), otherwise undefined behavior may occur when terminal operation commences.
parallel boolean: if true then the returned stream is a parallel stream; if false the returned stream is a sequential stream.
Returns
IntStream a new sequential or parallel IntStream

也可以看看:

longStream

Added in API level 24
LongStream longStream (Spliterator.OfLong spliterator, 
                boolean parallel)

创建一个新的串行或并行 LongStreamSpliterator.OfLong

在流管道的终端操作开始之后,分裂器仅被估计大小的遍历,拆分或查询。

强烈建议分割器报告IMMUTABLECONCURRENT的特征,或者late-binding 否则,应该使用longStream(java.util.function.Supplier, int, boolean)来减少潜在干扰源的范围。 有关更多详细信息,请参阅Non-Interference

Parameters
spliterator Spliterator.OfLong: a Spliterator.OfLong describing the stream elements
parallel boolean: if true then the returned stream is a parallel stream; if false the returned stream is a sequential stream.
Returns
LongStream a new sequential or parallel LongStream

longStream

Added in API level 24
LongStream longStream (Supplier<? extends Spliterator.OfLong> supplier, 
                int characteristics, 
                boolean parallel)

创建一个新的顺序或并行 LongStreamSupplierSpliterator.OfLong

get()方法将在供应商上调用不超过一次,并且仅在流管道的终端操作开始之后。

该报告的特性spliterators IMMUTABLE或者 CONCURRENT ,或者是 late-binding ,很可能更有效地使用 longStream(java.util.Spliterator.OfLong, boolean)代替。

以这种形式使用Supplier提供了间接的级别,从而减少了对源的潜在干扰的范围。 由于只在终端操作开始后调用供应商,所以直到终端操作开始时对源的任何修改都会反映在流结果中。 有关更多详细信息,请参阅Non-Interference

Parameters
supplier Supplier: a Supplier of a Spliterator.OfLong
characteristics int: Spliterator characteristics of the supplied Spliterator.OfLong. The characteristics must be equal to supplier.get().characteristics(), otherwise undefined behavior may occur when terminal operation commences.
parallel boolean: if true then the returned stream is a parallel stream; if false the returned stream is a sequential stream.
Returns
LongStream a new sequential or parallel LongStream

也可以看看:

stream

Added in API level 24
Stream<T> stream (Spliterator<T> spliterator, 
                boolean parallel)

创建一个新的串行或并行 StreamSpliterator

在流管道的终端操作开始之后,分裂器仅被估计大小的遍历,拆分或查询。

强烈建议分割器报告IMMUTABLECONCURRENT的特征,或者late-binding 否则,应使用stream(java.util.function.Supplier, int, boolean)来减少潜在干扰源的范围。 详情请参阅Non-Interference

Parameters
spliterator Spliterator: a Spliterator describing the stream elements
parallel boolean: if true then the returned stream is a parallel stream; if false the returned stream is a sequential stream.
Returns
Stream<T> a new sequential or parallel Stream

stream

Added in API level 24
Stream<T> stream (Supplier<? extends Spliterator<T>> supplier, 
                int characteristics, 
                boolean parallel)

创建一个新的顺序或并行 StreamSupplierSpliterator

get()方法将在供应商上调用不超过一次,并且仅在流管线的终端操作开始之后。

该报告的特性spliterators IMMUTABLE或者 CONCURRENT ,或者是 late-binding ,很可能更有效地使用 stream(java.util.Spliterator, boolean)代替。

以这种形式使用Supplier提供了间接的等级,从而减少了对源的潜在干扰的范围。 由于只在终端操作开始后调用供应商,所以直到终端操作开始时对源的任何修改都会反映在流结果中。 详情请参阅Non-Interference

Parameters
supplier Supplier: a Supplier of a Spliterator
characteristics int: Spliterator characteristics of the supplied Spliterator. The characteristics must be equal to supplier.get().characteristics(), otherwise undefined behavior may occur when terminal operation commences.
parallel boolean: if true then the returned stream is a parallel stream; if false the returned stream is a sequential stream.
Returns
Stream<T> a new sequential or parallel Stream

也可以看看:

Hooray!