1.JDK8常用函数式接口
2.示例代码
package com.imooc.lambda; import java.util.function.Consumer; /** * ConsumerSample接口的使用 */ public class ConsumerSample { public static void main(String[] args) { output(s -> System.out.println("Put:" + s)); } public static void output(Consumer<String> consumer) { String text = "123"; consumer.accept(text); } }
标签:函数,text,ConsumerSample,接口,static,004,public,String From: https://www.cnblogs.com/LLL0617/p/17031961.html