摘要: Stream 简介 JDK Stream和 Java IO中的流是两种东西, Stream是使用函数式编程模式来对集合数据进行链状流式操作。 基本玩法 对一个数组中的数字进行求和操作,Stream 代码如下: int[] a = {1, 2, 5, 8, 3, 9}; int sum = IntSt 阅读全文
posted @ 2021-06-18 09:54 Dreamsrj 阅读(95) 评论(0) 推荐(0)
摘要: 四种方式 定义 /** 定义函数接口 必须只有一个强制实现的方法 使用 @FunctionalInterface 标记该接口, 以在编译期检查是否有错误 可以有一个或多个默认方法 @FunctionalInterface public interface ICalculator { int squa 阅读全文
posted @ 2021-06-18 09:53 Dreamsrj 阅读(49) 评论(0) 推荐(0)