package com.wly.base;
/*
*文件名: HanShu
*创建者: 王洛伊
*创建时间:2024/1/4 15:54
*描述: 函数接口
*/
public class HanShu {
// Runnable,无参数值,无返回值
@FunctionalInterface
public interface Runnable{
public abstract void run();
}
// 功能式函数接口,接收一个参数,返回一个参数
@FunctionalInterface
public interface Function<T, R> {
R apply(T t);
}
// 消费式函数接口,无返回值
@FunctionalInterface
public interface Consumer<T> {
void accept(T t);
}
// 接收俩个参数,无返回值
@FunctionalInterface
public interface BiConsumer<T, U> {
void accept(T t, U u);
}
// 供给型函数接口,没有参数,有一个返回值
@FunctionalInterface
public interface Supplier<T> {
T get();
}
}
JAVA函数接口
最新推荐文章于 2024-05-16 10:23:10 发布