专栏名称: 朱小厮的博客
著有畅销书:《深入理解Kafka》和《RabbitMQ实战指南》。公众号主要用来分享Java技术栈、Golang技术栈、消息中间件(如Kafka、RabbitMQ)、存储、大数据以及通用型技术架构等相关的技术。
今天看啥  ›  专栏  ›  朱小厮的博客

你真的了解 lambda 吗(纠错篇)?

朱小厮的博客  · 公众号  ·  · 2019-07-17 08:42
点击上方“朱小厮的博客”,选择“设为星标”做积极的人,而不是积极废人来源:http://uee.me/aWWS21. 用法示例:最普遍的一个例子,执行一个线程new Thread(() -> System.out.print("hello world")).start();->  我们发现它指向的是 Runnable接口@FunctionalInterfacepublic interface Runnable {    /**     * When an object implementing interface Runnable is used     * to create a thread, starting the thread causes the object's     * run method to be called in that separately executing     * thread.     *     * The general contract of the method run is that it may     * take any action whatsoever.     *     * @see     java.lang.Thread#run()     */    public abstract void run();}分析->这个箭头是lambda表达式的关键操作符->把表达式分成两截,前面是函数参数,后面是函数体 ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照