forked from Labore/PR2-L
19 lines
529 B
Java
19 lines
529 B
Java
import java.util.function.BiFunction;
|
|
|
|
public class BiFunctionDemo {
|
|
public static void main(String args[])
|
|
{
|
|
BiFunction<Integer, Integer, Integer> composite1 = (a, b) -> a + b;
|
|
|
|
composite1 = composite1.andThen(a -> 2 * a);
|
|
|
|
System.out.println("Composite1 = " + composite1.apply(2, 3));
|
|
|
|
BiFunction<Integer, Integer, Integer> composite2 = (a, b) -> a * b;
|
|
|
|
composite2 = composite2.andThen(a -> 3 * a);
|
|
|
|
System.out.println("Composite2 = " + composite2.apply(2, 3));
|
|
}
|
|
}
|