langtools/test/tools/javac/lambda/lambdaExecution/TBlock.java
author alundblad
Mon, 18 Apr 2016 21:07:50 +0200
changeset 37633 d16d6d59446d
parent 14554 4e29b285c723
permissions -rw-r--r--
8036952: copyright issues in jdk9/dev/langtools files Summary: Updated copyright notices. Reviewed-by: jjg, jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37633
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     1
/*
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     4
 *
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     7
 * published by the Free Software Foundation.
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     8
 *
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    13
 * accompanied this code).
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    14
 *
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    18
 *
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    21
 * questions.
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    22
 */
d16d6d59446d 8036952: copyright issues in jdk9/dev/langtools files
alundblad
parents: 14554
diff changeset
    23
14554
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    24
/**
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    25
 * Performs operations upon an input object which may modify that object and/or
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    26
 * external state (other objects).
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    27
 *
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    28
 * <p>All block implementations are expected to:
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    29
 * <ul>
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    30
 * <li>When used for aggregate operations upon many elements blocks
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    31
 * should not assume that the {@code apply} operation will be called upon
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    32
 * elements in any specific order.</li>
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    33
 * </ul>
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    34
 *
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    35
 * @param <T> The type of input objects to {@code apply}.
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    36
 */
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    37
public interface TBlock<T> {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    38
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    39
    /**
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    40
     * Performs operations upon the provided object which may modify that object
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    41
     * and/or external state.
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    42
     *
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    43
     * @param t an input object
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    44
     */
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    45
    void apply(T t);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    46
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    47
    /**
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    48
     * Returns a Block which performs in sequence the {@code apply} methods of
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    49
     * multiple Blocks. This Block's {@code apply} method is performed followed
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    50
     * by the {@code apply} method of the specified Block operation.
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    51
     *
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    52
     * @param other an additional Block which will be chained after this Block
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    53
     * @return a Block which performs in sequence the {@code apply} method of
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    54
     * this Block and the {@code apply} method of the specified Block operation
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    55
     */
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    56
    public default TBlock<T> chain(TBlock<? super T> other) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    57
        return (T t) -> { apply(t); other.apply(t); };
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    58
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    59
}