码迷,mamicode.com
首页 > 其他好文 > 详细

函数式接口之Supplier练习

时间:2020-06-06 18:43:13      阅读:51      评论:0      收藏:0      [点我收藏+]

标签:tst   ima   private   com   alt   image   rgs   demo   vat   

技术图片

public class SupplierDemo {
    public static void main(String[] args) {
        String s = getString(()->"函数式接口");
        System.out.println(s);

        Integer i = getInteger(()->20);
        System.out.println(i);
    }
    private static String getString(Supplier<String> sup){
        return sup.get();
    }

    private static Integer getInteger(Supplier<Integer> sup){
        return sup.get();
    }
}

技术图片

 

函数式接口之Supplier练习

标签:tst   ima   private   com   alt   image   rgs   demo   vat   

原文地址:https://www.cnblogs.com/pxy-1999/p/13055482.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!