首页 > 其他 > 详细

函数式编程

时间:2019-06-25 19:18:01      阅读:84      评论:0      收藏:0      [点我收藏+]

案例1:

public static Object getV(String a){
        return new MyTestInface(){
            @Override
            public Object getValue(String str) {
                return "----" + str;
            }
        }.getValue(a);
    }


    public static void main(String[] args) {

        System.out.println(getV("你好"));
    }

案例2

 public static Object getV(String a,MyTestInface inface){
        return inface.getValue(a);
    }


    public static void main(String[] args) {
        String s = "nihao";
        System.out.println(getV(s,x->{
            return "s" + "霓虹";
        }));
    }

 

函数式编程

原文:https://www.cnblogs.com/chengyangyang/p/11084740.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!