/**
* @author yangquan
*/
public class DemoSupplier {
public static void main(String[] args) {
// String s = getString(() -> "helloworld");
// String s = getString(() -> "helloworld");
String s = getString(() -> "helloworld");
System.out.println("s: " + s);
Integer i = getString(() -> 123);
System.out.println("i: " + i);
}
public static <T> T getString(Supplier<T> lambda) {
return lambda.get();
}
}
类似于这种
按照图示操作即可
这辈子坚持与不坚持都不可怕,怕的是独自走在坚持的道路上!!