BiConsumer accept example
Description
Performs BiConsumer operation on the given arguments.
Syntax
accept
has the following syntax.
void accept(T t, U u)
Example
The following example shows how to use accept
.
import java.util.function.BiConsumer;
// ww w . j ava 2 s .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.accept("java2s.com", " tutorials");
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »