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

无锡哪里有建设网站学平面设计网上哪个培训好

无锡哪里有建设网站,学平面设计网上哪个培训好,凡客官网免费制作小程序,找聊城做网站四大函数式接口 函数式接口#xff1a;只有一个方法的接口 #xff0c;例如#xff1a;Runnable接口 Function 函数型接口#xff0c;有一个输入参数#xff0c;有一个输出 源码#xff1a; /*** Represents a function that accepts one argument and produces a resul…四大函数式接口 函数式接口只有一个方法的接口 例如Runnable接口 Function 函数型接口有一个输入参数有一个输出 源码 /*** Represents a function that accepts one argument and produces a result.** This is a functional interface* whose functional method is apply(Object).** param T the type of the input to the function* param R the type of the result of the function** since 1.8*/ FunctionalInterface public interface FunctionT, R {/*** Applies this function to the given argument.** param t the function argument* return the function result*/R apply(T t);示例 package function;import java.util.function.Function;/**** Function 函数型接口有一个输入参数有一个输出* 只要是函数式接口就可以用lambda表达式*/ public class Demo01 {public static void main(String[] args) {// 匿名内部类工具类输出输入的结果 // Function function new FunctionString,String() { // Override // public String apply(String s) { // // return null; // } // };// 使用lambda表达式Function function (str)-{return str;};System.out.println(function.apply(abc));} }Predicate 断定型接口只有一个输入参数返回值为boolean 源码 /*** Represents a predicate (boolean-valued function) of one argument.** This is a functional interface* whose functional method is test(Object).** param T the type of the input to the predicate** since 1.8*/ FunctionalInterface public interface PredicateT {/*** Evaluates this predicate on the given argument.** param t the input argument* return {code true} if the input argument matches the predicate,* otherwise {code false}*/boolean test(T t);示例 package function;import java.util.function.Predicate;/**** 断定型接口有一个输入参数返回值为boolean*/ public class Demo02 {public static void main(String[] args) {// 判断字符串是否为空 // Predicate predicate new PredicateString() { // Override // public boolean test(String s) { // return s.isEmpty(); // } // };// 函数型接口lambda表达式使代码看起来更加简洁PredicateString predicate (s)-{return s.isEmpty();};System.out.println(predicate.test());} }Consumer 消费型接口有一个参数没有返回值 源码 /*** Represents an operation that accepts a single input argument and returns no* result. Unlike most other functional interfaces, {code Consumer} is expected* to operate via side-effects.** pThis is afunctional interface* whose functional method is accept(Object).** param T the type of the input to the operation** since 1.8*/ FunctionalInterface public interface ConsumerT {/*** Performs this operation on the given argument.** param t the input argument*/void accept(T t);示例 package function;import javax.lang.model.element.NestingKind; import java.util.function.Consumer;/**** Consumer 消费型接口只有输入没有返回值*/ public class Demo03 {public static void main(String[] args) { // ConsumerString consumer new ConsumerString() { // Override // public void accept(String s) { // System.out.println(s); // } // };ConsumerString consumer (s)-{System.out.println(s);};consumer.accept(asd);} }Supplier 供给型接口没有参数只有返回值 源码 /*** Represents a supplier of results.** There is no requirement that a new or distinct result be returned each* time the supplier is invoked.** This is a functional interface* whose functional method isget().** param T the type of results supplied by this supplier** since 1.8*/ FunctionalInterface public interface SupplierT {/*** Gets a result.** return a result*/T get(); }示例 package function;import java.util.function.Supplier;/**** 供给型接口没有参数只有返回值*/ public class Demo04 {public static void main(String[] args) { // SupplierInteger supplier new SupplierInteger() { // // Override // public Integer get() { // return 1024; // } // };SupplierInteger supplier ()-{return 1024;};System.out.println(supplier.get());} }为什么要学习函数式接口 简化编程模型使代码更加可读易懂 在新版本的框架底层中函数式接口有大量的应用
http://www.dnsts.com.cn/news/116958.html

相关文章:

  • 潜江网站搭建点击器免费版
  • 怎么做自动跳转网站一站式网页设计服务平台
  • 婚庆网站搭建的流程游戏类网站备案
  • 阿里有做网站网页游戏怎么搭建
  • 商业网站唐山公司网站建设
  • html5做宠物饲养网站四川城乡和住房建设厅官方网站
  • 企业自助建站系统下载wordpress $user_id
  • 会宁县建设局网站注册个体户
  • 网站宣传制作应用网站模板
  • 网站欣赏与创建网页体育器材网站建设方案
  • 网站建设岗位工作职责开发微信小程序的工具
  • 国外html5做的音乐网站吉林系统建站怎么用
  • 网站设计区域石家庄有没有销售做被用的网站
  • 河南省住房与城乡建设厅网站医疗网站建设基本流程
  • 买的网站模板怎么上传现在流行什么做网站
  • 做一个网站的全部流程wordpress动画插件下载
  • 天津网站建设 阿土伯落伍者论坛 做网站
  • 找印度人做网站做的比较好的意大利网站
  • 做网站会员金字塔系统安仁网络推广软件定制开发
  • 沈阳网站建设的价格门户系统建设
  • 网页ui设计网站建筑模板规格一览表
  • 聊城定制型网站开发wordpress删除插件
  • 虚拟主机建设二个网站哪家网站做旅游攻略好
  • 深圳市网站建设制作设计品牌自己建设的网站打开慢
  • 网络广告案例以及分析关键词分布中对seo有危害的
  • django做购物网站房产网查询备案
  • 有关网站建设的app哈尔滨公共资源交易中心官网
  • 建网站深圳餐饮小程序制作
  • 校园社交网站开发微信优惠券网站怎么做的
  • 苏州建站之家西安百度推广优化托管