当前位置: 首页 > news >正文

网站小图标怎么做软件工程月薪一般多少

网站小图标怎么做,软件工程月薪一般多少,潮州市工程建设网站,wordpress qq登录免费这里写自定义目录标题 一、什么是函数式接口二、自定义函数式接口三、作为参数传递 Lambda 表达式四、四大内置核心函数式接口1、消费形接口2、供给形接口3、函数型接口4、断言形接口 一、什么是函数式接口 只包含一个抽象方法的接口,称为函数式接口。你可以通过 L…

这里写自定义目录标题

  • 一、什么是函数式接口
  • 二、自定义函数式接口
  • 三、作为参数传递 Lambda 表达式
  • 四、四大内置核心函数式接口
      • 1、消费形接口
      • 2、供给形接口
      • 3、函数型接口
      • 4、断言形接口

一、什么是函数式接口

  • 只包含一个抽象方法的接口,称为函数式接口。
  • 你可以通过 Lambda 表达式来创建该接口的对象。
  • 我们可以在任意函数式接口上使用 @FunctionalInterface 注解,这样做可以检查它是否是一个函数式接口,同时 javadoc 也会包含一条声明,说明这个接口是一个函数式接口

二、自定义函数式接口

@FunctionalInterface
public interface MyFunction {public String getValue(String str);
}@FunctionalInterface
public interface MyFunc<T> {public R getValue(T t);
}

三、作为参数传递 Lambda 表达式

@FunctionalInterface
public interface MyFunc<T> {public T getValue(T t);
}public String toUpperString(MyFunc<String> mf, String str) {mf.getValue(str)
}//Lambda 表达式作为参数传递
String str1 = toUpperString(str -> str.toUpperCase(),"abcd");
sout(str1 )

四、四大内置核心函数式接口

在这里插入图片描述

1、消费形接口

    //Consumer: 消费型接口@Testpublic void test1(){happy(35,d -> System.out.println("花费了"+d));}public void happy(double money, Consumer<Double> con){con.accept(money);}

2、供给形接口

    @Testpublic void test2(){List<Integer> numberList = getNumberList(10, () -> (int) (Math.random() * 100));for(Integer num : numberList){System.out.println(num);}}//需求:产生一些整数,并放在集合中public List<Integer> getNumberList(int num, Supplier<Integer> sup){List<Integer> list = new ArrayList<>();for(int i = 0; i < num ; i++){list.add(sup.get());}return list;}

3、函数型接口

    @Testpublic void test3(){String result = Strandler("\t\thello world,i like china!", str -> str.trim());System.out.println(result);}//需求:用于处理字符串public String Strandler(String str, Function<String,String> fun){return fun.apply(str);}

4、断言形接口

 @Testpublic void test4(){List<String> employees = Arrays.asList("hello","houchen","shuchenxi");List<String> list = filterStr(employees, str -> str.length() >3);for(String s : list){System.out.println(s);}}//需求:将满足条件的字符串放入集合中public List<String> filterStr(List<String> list, Predicate<String> pre){List<String> stringList = new ArrayList<>();for(String str : list){if(pre.test(str)){stringList.add(str);}}return stringList;}
http://www.yayakq.cn/news/690338/

相关文章:

  • 网站开发技术及开发环境高端电商设计公司
  • 怎样做宣传网站商城小程序
  • 2018做网站站长免费的项目管理软件
  • 良庆网站建设手工做衣服的网站
  • 代理网站地址深圳南头网站建设公司
  • 公司网站建设开发室内装修公司名字大全
  • 新房地产网站开发免费上外国网站的浏览器
  • 淄博网站制作服务推广wordpres做影视网站
  • 站长资源平台百度云加速
  • 南京企业免费建站太原网站制作公司哪家好
  • 做外贸外文网站怎么做好品牌网站建设磐石网络优等
  • 搜索引擎网站排名seo网站推广佛山
  • wordpress站内信网页小游戏下载
  • 柴沟堡做网站备案时的网站名称
  • 网站常用英文字体域名安全检测中心
  • 如何进行医药网站建设现在注册一个公司要多少钱
  • 汽贸做网站有用处吗株洲新区发布
  • 怎么制作企业网站做公司网站麻烦吗
  • 易营宝自助建站系统网站在线报名怎么做
  • 做神马网站快速排网站服务器地址在哪里看
  • 东南亚cod建站工具推荐几个做网页设计的网站
  • 浦东新区建设局网站格尔木有做网站的吗
  • 贵阳平台网站建设多语言企业网站开发
  • 新泰网站建设方案Wordpress慢加内存还是带宽
  • 咸宁商城网站建设网络营销推广方式有几种
  • 网站建设效果wordpress 请选择一个文件
  • 网站优化 济南百度地址如何设置门店地址
  • 什么是网站解决方案wordpress购物车
  • 郑州易站通网站公司做一个网站怎么赚钱
  • 东胜网站制作建立网站就是制作网页对吗