@FunctionalInterface
public interface Function<T, R> {
R apply(T t);
default <V> Function<T, V> andThen(Function<? super R, ? extends V> after) {
Objects.requireNonNull(after);
return (T t) -> after.apply(apply(t));
}
static <T> Function<T, T> identity() {
return t -> t;
}
}
function中有一个apply方法
有返回值,有输入参数:R apply(T t)
用法:
Function<String, String> f = (str) -> str.toUpperCase();
f.apply("lelonta");