函数式接口

1. @FunctionalInterface函数式接口,一般可以作为方法的参数和返回值类型。
(1)有且只有一个抽象方法的接口,称之为函数式接口
(2)可以包含其他的方法(默认,静态,私有)


2. Runnable
void run()

3. Function<T, R>
R apply(T t);
default <V> Function<V, R> compose(Function<? super V, ? extends T> before);
default <V> Function<T, V> andThen(Function<? super R, ? extends V> after);

4. BiFunction<T, U, R>
R apply(T t, U, u);
default <V> BiFunction<T, U, V> andThen(Function<? super R, ? extends V> after);


5. Supplier<T>
T get();

6. Consumer<T>
void accept(T t);
Consumer<T> andThen(Consumer<? super T> after);

7. BiConsumer<T, U>
void accept(T t, U u);
default BiConsumer<T, U> andThen(BiConsumer<? super T, ? super U> after);

8. Predicate<T>
boolean test(T t);
default Predicate<T> and(Predicate<? super T> other);
default Predicate<T> negate();
default Predicate<T> or(Predicate<? super T> other);

9. BiPredicate<T, U>
boolean test(T t, U u);
default BiPredicate<T, U> and(Predicate<? super T, ? super U> other);
default Predicate<T, U> negate();
default Predicate<T, U> or(Predicate<? super T, ? super U> other);

posted @   小路不懂2  阅读(44)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
历史上的今天:
2018-03-28 mybatis - Java API
点击右上角即可分享
微信分享提示