用例子来学会 Stream
引言 先从一个例子开始,看看为什么在Java8中要引入流(Stream)? 比如实现这么一个需求:在学生集合中查找男生的数量。 传统的写法为: public long getCountsOfMaleStudent(ListStudent students) { long count = 0; for (Student student : students) { if
引言 先从一个例子开始,看看为什么在Java8中要引入流(Stream)? 比如实现这么一个需求:在学生集合中查找男生的数量。 传统的写法为: public long getCountsOfMaleStudent(ListStudent students) { long count = 0; for (Student student : students) { if