LongConsumer andThen example
Description
LongConsumer andThen returns a composed LongConsumer that performs, in sequence, this operation followed by the after operation.
Syntax
andThen
has the following syntax.
default LongConsumer andThen(LongConsumer after)
Example
The following example shows how to use andThen
.
import java.util.function.LongConsumer;
/*from w w w. jav a 2 s. c o m*/
public class Main {
public static void main(String[] args) {
LongConsumer i = (l) -> System.out.println(l);;
i.andThen(i).accept(Long.MAX_VALUE);
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »