识别内置功能接口

identify build in functional interface

Q: Given the following lambda expression: (name, age, isAdult) -> new Person(name, age, isAdult), identify the build in interface.

我已经成功编写了自己的功能界面:

@FunctionalInterface
public interface Generator<T,U,V,R> {
    R generate(T t, U u, V v);
}

但是不知道有没有必要写这个接口,或者java已经有内置接口了

没有。 java.util.function 包中没有任何内容适用于此。

如果函数只有 2 个参数,例如

(name, age) -> ...

那么你可以使用 BiFunction 但没有“TriFunction”。