public interface Consumer
| java.util.function.Consumer<T> |
| |
表示接受单个输入参数且不返回结果的操作。 与大多数其他功能接口不同, Consumer预计将通过副作用进行操作。
这是一个 functional interface,其功能方法是 accept(Object) 。
公共方法(Public methods) |
|
|---|---|
abstract void |
accept(T t) 对给定的参数执行此操作。 |
default Consumer<T> |
andThen(Consumer<? super T> after) 返回合成的 |
Consumer<T> andThen (Consumer<? super T> after)
返回一个合成的Consumer ,按顺序执行此操作,然后执行after操作。 如果执行任一操作会引发异常,则将其传递给组合操作的调用者。 如果执行此操作会引发异常,则不会执行after操作。
| 参数(Parameters) | |
|---|---|
after |
Consumer: the operation to perform after this operation |
| 返回(Returns) | |
|---|---|
Consumer<T> |
a composed Consumer that performs in sequence this operation followed by the after operation |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if after is null |