java8新特性:Stream
Stream:流
主要为了处理数据
如 List、数组等可以 stream() 方法转换为流
public static void main(String[] args) { List<Integer> list = Arrays.asList(21,5,9,15,3); list.stream(); String[] s = {"",""}; Arrays.stream(s);
也可以通过Stream.of() 将提供的数据转换成流
对流操作分为 中间操作 和 终止操作
中间操作返回的是流:filter() map()
终止操作返回的不是流:match() find() reduce() collect()
具体使用参照参数所需要的 函数式接口

浙公网安备 33010602011771号