lamda表达式和stream

  stream主要用于处理数据,看一下jdk的文档,并且主要处理集合对象:

int sum = widgets.stream() .filter(w -> w.getColor() == RED) .mapToInt(w -> w.getWeight()) .sum();

原文地址:https://www.cnblogs.com/Robin008/p/9780335.html