BiConsumer andThen returns a composed BiConsumer that performs, in sequence, this operation followed by the after operation.
andThen
has the following syntax.
default BiConsumer<T,U> andThen(BiConsumer<? super T,? super U> after)
The following example shows how to use andThen
.
import java.util.function.BiConsumer; /* w w w . j a v a 2 s . co 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.