1、Consumer :消费型接口
@FunctionalInterface
public interface Consumer<T> {
/**
* Performs this operation on the given argument.
*
* @param t the input argument
*/
void accept(T t);
}
应用举例
public void happy(double money,Consumer<Double> con){
con.accept(money);
}
public void test(){
happy(1000, m -> System.out.print("消费"+m+"元"));
}
2、Supplier :供给型接口
@FunctionalInterface
public interface S