Lambda Expressions in Java: Syntax and Examples

Functional Interface Function

1/2

What is the output of the code:

Function<String, String> f1 = s -> s + "-f1-";
Function<String, String> f2 = s -> s + "-f2-";
Function<String, String> f3 = s -> s + "-f3-";

System.out.println(f1.andThen(f3).compose(f2).apply("Compose"));
System.out.println(f1.andThen(f2).andThen(f3).apply("AndThen"));
Comments