Most visited

Recently visited

Added in API level 24

LongStream.Builder

public static interface LongStream.Builder
implements LongConsumer

java.util.stream.LongStream.Builder


LongStream可变建设者。

流生成器具有生命周期,该生命周期始于构建阶段,在此阶段中可以添加元素,然后过渡到构建阶段,之后可能不会添加元素。 构建阶段从build()方法被调用时开始,该方法创建一个有序流,其元素是添加到流构建器的元素,按照它们添加的顺序。

也可以看看:

Summary

Public methods

abstract void accept(long t)

为正在构建的流添加一个元素。

default LongStream.Builder add(long t)

为正在构建的流添加一个元素。

abstract LongStream build()

构建流,将此构建器转换为构建状态。

Inherited methods

From interface java.util.function.LongConsumer

Public methods

accept

Added in API level 24
void accept (long t)

为正在构建的流添加一个元素。

Parameters
t long: the input argument
Throws
IllegalStateException if the builder has already transitioned to the built state

add

Added in API level 24
LongStream.Builder add (long t)

为正在构建的流添加一个元素。

实现要求:
  • The default implementation behaves as if:
    accept(t)
         return this;
     
Parameters
t long: the element to add
Returns
LongStream.Builder this builder
Throws
IllegalStateException if the builder has already transitioned to the built state

build

Added in API level 24
LongStream build ()

构建流,将此构建器转换为构建状态。 如果在构建器进入构建状态后还有其他尝试在构建器上进行操作,则会抛出IllegalStateException

Returns
LongStream the built stream
Throws
IllegalStateException if the builder has already transitioned to the built state

Hooray!