BiConsumer andThen example
Description
BiConsumer andThen returns a composed BiConsumer that performs, in sequence, this operation followed by the after operation.
Syntax
andThen
has the following syntax.
default BiConsumer<T,U> andThen(BiConsumer<? super T,? super U> after)
Example
The following example shows how to use andThen
.
import java.util.function.BiConsumer;
//from w w w .j a v a 2s. c o m
public class Main {
public static void main(String[] args) {
BiConsumer<String, String> biConsumer = (x, y) -> {
System.out.println(x);
System.out.println(y);
};
biConsumer.andThen(biConsumer).accept("java2s.com", " tutorial");
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »