test/tools/javac/lambda/lambdaExecution/TBlock.java

Wed, 28 Aug 2013 10:17:23 -0700

author
henryjen
date
Wed, 28 Aug 2013 10:17:23 -0700
changeset 1983
7de7100c30ce
parent 0
959103a6100f
permissions
-rw-r--r--

8014566: Remove @ignore tags from MethodReference66 and InInterface when 8013875 is fixed
Reviewed-by: briangoetz, jjg

     1 /**
     2  * Performs operations upon an input object which may modify that object and/or
     3  * external state (other objects).
     4  *
     5  * <p>All block implementations are expected to:
     6  * <ul>
     7  * <li>When used for aggregate operations upon many elements blocks
     8  * should not assume that the {@code apply} operation will be called upon
     9  * elements in any specific order.</li>
    10  * </ul>
    11  *
    12  * @param <T> The type of input objects to {@code apply}.
    13  */
    14 public interface TBlock<T> {
    16     /**
    17      * Performs operations upon the provided object which may modify that object
    18      * and/or external state.
    19      *
    20      * @param t an input object
    21      */
    22     void apply(T t);
    24     /**
    25      * Returns a Block which performs in sequence the {@code apply} methods of
    26      * multiple Blocks. This Block's {@code apply} method is performed followed
    27      * by the {@code apply} method of the specified Block operation.
    28      *
    29      * @param other an additional Block which will be chained after this Block
    30      * @return a Block which performs in sequence the {@code apply} method of
    31      * this Block and the {@code apply} method of the specified Block operation
    32      */
    33     public default TBlock<T> chain(TBlock<? super T> other) {
    34         return (T t) -> { apply(t); other.apply(t); };
    35     }
    36 }

mercurial