使用示例
public class Test {
public static void main(String args[]) {
Supplier<String > s = ()->{
return "费哥哥,我爱你哦!";
};
System.out.println( s.get());
}
}
结果:
费哥哥,我爱你哦!
Supplier 源码
package java.util.function;
/**
* 供给型接口
*/
@FunctionalInterface
public interface Supplier<T> {
T get();
}