public static interface LongStream.Builder extends LongConsumer
LongStream
可变构建器。
流构建器具有生命周期,其从构建阶段开始,在该阶段期间可以添加元素,然后转换到内置阶段,之后可能不添加元素。 当调用build()
方法时,内建阶段开始,它创建一个有序流,其元素是添加到流构建器的元素,按照它们的添加顺序。
LongStream.builder()
Modifier and Type | Method and Description |
---|---|
void |
accept(long t)
向要构建的流添加元素。
|
default LongStream.Builder |
add(long t)
向要构建的流添加元素。
|
LongStream |
build()
构建流,将此构建器转换为内置状态。
|
andThen
void accept(long t)
accept
在界面
LongConsumer
t
- 输入参数
IllegalStateException
- 如果构建器已经转换到内置状态
default LongStream.Builder add(long t)
accept(t) return this;
t
- 要添加的元素
this
建设者
IllegalStateException
- 如果构建器已经转换到内置状态
LongStream build()
IllegalStateException
。
IllegalStateException
- 如果构建器已经转换到内置状态
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.