java8自带常用的函数式接口
Predicateboolean test(T t) 传入一个参数返回boolean值
Consumervoid accept(T t) 传入一个参数,无返回值
Function R apply(T t) 传入一个参数,返回另一个类型
准备数据
//计算机俱乐部
private static List computerClub = Arrays.asList(
new Student("2015134001", "小明", 15, "1501"),
new Student("2015134003", "小王", 14, "1503"),
new Student("2015134006", "小张", 15, "1501"),
new Student("2015134008", "小梁", 17, "1505")
);
//篮球俱乐部
private static List basketballClub = Arrays.asList(
new Student("2015134012", "小c", 13, "1503"),
new Student("2015134013", "小s", 14, "1503"),
new Student("2015134015", "小d", 15, "1504"),
new Student("2015134018", "小y", 16, "1505")
);
//乒乓球俱乐部
private static List pingpongClub = Arrays.asList(
new Student("2015134022", "小u", 16, "1502"),
new Student("2015134021", "小i", 14, "1502"),
new Student("2015134026", "小m", 17, "1504"),
new Student("2015134027", "小n", 16, "1504")
);
private static List> allClubStu = new ArrayList<>();
allClubStu.add(computerClub);
allClubStu.add(basketballClub);
allClubStu.add(pingpongClub);
常用的stream三种创建方式
集合 Collection.stream()
静态方法 Stream.of
<