@FunctionalInterface 注解

2017-10-18  本文已影响138人  kangkaii

发现地:标注在 “函数式接口” 上方 interface Predicate<T>()

@FunctionalInterface
public interface Predicate<T> {
    /**
     * Evaluates this predicate on the given argument.
     *
     * @param t the input argument
     * @return {@code true} if the input argument matches the predicate,
     * otherwise {@code false}
     */
    boolean test(T t);
    //未完。。。。

作用:表明这是一个函数接口(对编译器),如果不是一个函数式接口,编译器会报错;反之,如果已经是一个函数式接口,有没有此注解都不造成影响。

相关知识点:

上一篇 下一篇

猜你喜欢

热点阅读