Q: Given the following lambda expression:
(name, age, isAdult) -> new Person(name, age, isAdult)
, identify the build in interface.
I've managed to write my own functional interface:
@FunctionalInterface
public interface Generator<T,U,V,R> {
R generate(T t, U u, V v);
}
But I don't know if is necessary to write this interface, or java already has a build-in interface.
Nope. There's nothing in the java.util.function
package which applies to this.
If the function only had 2 arguments, e.g.
(name, age) -> ...
then you could use BiFunction
but there is no "TriFunction
".