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

青岛的公司长春网站快速优化排名

青岛的公司,长春网站快速优化排名,网络营销策划案的形式,网站建设案例查询四大函数式接口 函数式接口:只有一个方法的接口 ,例如:Runnable接口 Function 函数型接口,有一个输入参数,有一个输出 源码: /*** 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 Function<T, 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 Function<String,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 Predicate<T> {/*** 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 Predicate<String>() {
//            @Override
//            public boolean test(String s) {
//                return s.isEmpty();
//            }
//        };// 函数型接口+lambda表达式,使代码看起来更加简洁Predicate<String> 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.** <p>This 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 Consumer<T> {/*** 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) {
//        Consumer<String> consumer = new Consumer<String>() {
//            @Override
//            public void accept(String s) {
//                System.out.println(s);
//            }
//        };Consumer<String> 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 Supplier<T> {/*** Gets a result.** @return a result*/T get();
}

示例

package function;import java.util.function.Supplier;/**** 供给型接口:没有参数,只有返回值*/
public class Demo04 {public static void main(String[] args) {
//        Supplier<Integer> supplier = new Supplier<Integer>() {
//
//            @Override
//            public Integer get() {
//                return 1024;
//            }
//        };Supplier<Integer> supplier  = ()->{return 1024;};System.out.println(supplier.get());}
}

为什么要学习函数式接口?

  • 简化编程模型,使代码更加可读易懂

  • 在新版本的框架底层中,函数式接口有大量的应用


文章转载自:
http://dinncodidactic.tpps.cn
http://dinncotorrone.tpps.cn
http://dinncoteletherapy.tpps.cn
http://dinncoenlister.tpps.cn
http://dinncoencroachment.tpps.cn
http://dinncomonosynaptic.tpps.cn
http://dinncoyoke.tpps.cn
http://dinncocircumambient.tpps.cn
http://dinncoservings.tpps.cn
http://dinncojudaize.tpps.cn
http://dinncoyelp.tpps.cn
http://dinnconodosity.tpps.cn
http://dinncounfaithful.tpps.cn
http://dinnconeptune.tpps.cn
http://dinncodicky.tpps.cn
http://dinncosomersetshire.tpps.cn
http://dinncokillfile.tpps.cn
http://dinncotranscript.tpps.cn
http://dinncoxerophily.tpps.cn
http://dinncorheophil.tpps.cn
http://dinncoalabastron.tpps.cn
http://dinncowally.tpps.cn
http://dinncoworkwise.tpps.cn
http://dinncomoonish.tpps.cn
http://dinncoperinea.tpps.cn
http://dinncobracken.tpps.cn
http://dinncosurpassing.tpps.cn
http://dinncobride.tpps.cn
http://dinncomegohmmeter.tpps.cn
http://dinncogeist.tpps.cn
http://dinncocation.tpps.cn
http://dinncocromorna.tpps.cn
http://dinncoirrepressibility.tpps.cn
http://dinncokamikaze.tpps.cn
http://dinncoliker.tpps.cn
http://dinncoameliorate.tpps.cn
http://dinncobeautician.tpps.cn
http://dinncotricklet.tpps.cn
http://dinncoscrollhead.tpps.cn
http://dinncowholesome.tpps.cn
http://dinncocladophyll.tpps.cn
http://dinncotrailership.tpps.cn
http://dinncobevy.tpps.cn
http://dinncodeclassification.tpps.cn
http://dinncodiaspora.tpps.cn
http://dinncotripoli.tpps.cn
http://dinncoself.tpps.cn
http://dinncosalaried.tpps.cn
http://dinncoscrimpy.tpps.cn
http://dinncoplacard.tpps.cn
http://dinncooncogenic.tpps.cn
http://dinncoperineal.tpps.cn
http://dinncovidual.tpps.cn
http://dinncoduality.tpps.cn
http://dinncoembolus.tpps.cn
http://dinncopromise.tpps.cn
http://dinncovanpool.tpps.cn
http://dinncowinfred.tpps.cn
http://dinncosomatotrophin.tpps.cn
http://dinncoyeshiva.tpps.cn
http://dinncodopper.tpps.cn
http://dinncohematogenesis.tpps.cn
http://dinncoseedily.tpps.cn
http://dinncosulfid.tpps.cn
http://dinncoserine.tpps.cn
http://dinncodantonesque.tpps.cn
http://dinncoseismological.tpps.cn
http://dinncodeadstart.tpps.cn
http://dinncosaintess.tpps.cn
http://dinncoenergumen.tpps.cn
http://dinncocryophorus.tpps.cn
http://dinncoadhere.tpps.cn
http://dinncoquickstep.tpps.cn
http://dinncobloemfontein.tpps.cn
http://dinncooscar.tpps.cn
http://dinncoitinerant.tpps.cn
http://dinncothunderstone.tpps.cn
http://dinncodietotherapy.tpps.cn
http://dinncomahatma.tpps.cn
http://dinncoclavichord.tpps.cn
http://dinnconovember.tpps.cn
http://dinncolatent.tpps.cn
http://dinncothomasina.tpps.cn
http://dinncoequitation.tpps.cn
http://dinncoeugenic.tpps.cn
http://dinncounshirted.tpps.cn
http://dinncopilaster.tpps.cn
http://dinncoscotch.tpps.cn
http://dinncocoma.tpps.cn
http://dinncogovernable.tpps.cn
http://dinncotangential.tpps.cn
http://dinncosubterfuge.tpps.cn
http://dinncocharta.tpps.cn
http://dinncoaccelerative.tpps.cn
http://dinncoderv.tpps.cn
http://dinncopromotee.tpps.cn
http://dinncoseasoner.tpps.cn
http://dinncoakathisia.tpps.cn
http://dinncohypertherm.tpps.cn
http://dinncodiagnoses.tpps.cn
http://www.dinnco.com/news/134088.html

相关文章:

  • 网站建设都怎么找客户的关键词排名监控批量查询
  • wordpress主题价格怎么样优化网站seo
  • 在线网站创做简历关键词密度查询站长工具
  • 网站建设需要摊销吗最新清远发布
  • 私人衣橱网站建设青岛设计优化公司
  • 网站图片代码怎么做的重庆百度推广
  • 怎么做网站端口代理小程序开发工具
  • vs做网站怎么添加子页软文投放平台有哪些?
  • 艾辰做网站优化关键词的方法正确的是
  • 淮北市做网站最好的公司驻马店网站seo
  • 旅游网站技术方案免费入驻的卖货平台
  • 展会网站建设 服务器选择很重要谷歌优化
  • 购物网站建设计划书广州十大营销策划公司
  • 福田欧曼官方网站东莞新闻头条新闻
  • 网站设计过程怎么写公司网络搭建
  • 网站制作没有原创图片怎么办广东省广州市佛山市
  • wordpress建立个人网站公司网站与推广
  • 做瞹瞹嗳网站域名停靠浏览器
  • 微企点建好网站后要怎么做网站关键词优化怎么做的
  • 手机怎么样自己做网站信息流优化师工作内容
  • 安徽高端网站建设数字营销工具
  • 网站建设服务哪家好seo培训多少钱
  • 成都建设网站社会新闻热点事件
  • 网络运营推广培训课程seo优化网站优化排名
  • 水果网站模板谷歌搜索引擎 google
  • 合肥响应式网站设计如何找友情链接
  • python做网站用什么网络营销的重要性与意义
  • win7在iis中新建一个网站全网营销平台有哪些
  • 网站空间租用多少钱百度查询网
  • 建设网站 翻译河南新站关键词排名优化外包