接口 ForEachAction<T>

  • 类型参数:
    T - the type of the element
    函数接口:
    这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

    @FunctionalInterface
    public interface ForEachAction<T>
    Represents an operation that accepts two input arguments and returns no result. The first input argument is int-valued and usually consuming the each index in an array or a list. The second input argument is usually consuming the each element in an array or a list.
    从以下版本开始:
    2.5
    • 方法详细资料

      • accept

        void accept​(int index,
                    T elemnt)
        Performs this operation on the given arguments.
        参数:
        index - the index
        elemnt - the element
      • andThen

        default ForEachAction<T> andThen​(ForEachAction<? super T> after)
        Returns a composed ForEachAction that performs, in sequence, this operation followed by the after operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the after operation will not be performed.
        参数:
        after - the operation to perform after this operation
        返回:
        a composed ForEachAction that performs in sequence this operation followed by the after operation
        抛出:
        java.lang.NullPointerException - if after is null