-
- All Known Subinterfaces:
-
LongStream.Builder
- 所有已知实现类:
-
LongSummaryStatistics
- Functional Interface:
- 这是一个功能界面,因此可以用作lambda表达式或方法引用的赋值对象。
@FunctionalInterface public interface LongConsumer
表示接受单个long参数的操作,并且不返回任何结果。 这是long的long的原始类型专业化。 与大多数其他功能接口不同,LongConsumer预计通过副作用进行操作。这是一个functional interface的功能方法是
accept(long)。- 从以下版本开始:
- 1.8
- 另请参见:
-
Consumer
-
-
方法摘要
所有方法 接口方法 抽象方法 Default Methods Modifier and Type 方法 描述 voidaccept(long value)对给定的参数执行此操作。default LongConsumerandThen(LongConsumer after)返回一个组成的LongConsumer,依次执行此操作,然后执行after操作。
-
-
-
方法详细信息
-
accept
void accept(long value)
对给定的参数执行此操作。- 参数
-
value- 输入参数
-
andThen
default LongConsumer andThen(LongConsumer after)
返回一个组合的LongConsumer,依次执行此操作,然后执行after操作。 如果执行任一操作会抛出异常,它将被转发到组合操作的调用者。 如果执行此操作将抛出异常,则不会执行after操作。- 参数
-
after- 此操作后执行的操作 - 结果
-
一个组成的
LongConsumer,按顺序执行这个操作,然后是after操作 - 异常
-
NullPointerException- 如果after为空
-
-