package java.util.function;
/**
* Represents a supplier of results.
*
* There is no requirement that a new or distinct result be returned each
* time the supplier is invoked.
*/
@FunctionalInterface
public interface Supplier<T> {
/**
* Gets a result.
*/
T get();
}
import java.util.function.Supplier;
public class Test {
public static void main(String args[]) {
Supplier<String > s = ()->{
return "费哥哥,我爱你哦!";
};
System.out.println( s.get());
}
}
原文:https://www.cnblogs.com/feiqiangsheng/p/15225874.html