Java8Stream的flatmap方法使用
2021-04-19 09:30
标签:out ffd 音乐 this 通过 有关 getname array 入参 Java8Stream的flatmap方法使用 标签:out ffd 音乐 this 通过 有关 getname array 入参 原文地址:https://www.cnblogs.com/xfyy-2020/p/13289066.html// 老师
public class Teacher {
private String id;
private String name;
private String subject;
}
// 学生
public class Student {
private String id;
private String name;
private String techId;
// 重写hashCode及equals方法(id及name相同就为同一个学生)
}
// 家长
public class Parents {
private String id;
private String name;
private String chirldId;
private String email;
}
// 课程
public enum Subject {
private String value;
private String desc;
Subject(String value, String desc) {
this.value = value;
this.desc = desc;
}
Math("1", "数学"),
Chinese("2", "汉语"),
Music("3", "音乐"),
English("4", "英语");
}
public class Test {
// 模拟数据
public static Student s1 = new Student("1", "zhangsan", "001");
public static Student s2 = new Student("2", "lisi", "001");
public static Student s3 = new Student("3", "wangwu", "001");
public static Student s4 = new Student("4", "zhaoliu", "001");
public static Student s5 = new Student("6", "tianqi", "001");
public static Student s6 = new Student("6", "tianqi", "002");
public static Student s7 = new Student("6", "tianqi", "003");
public static Teacher t1 = new Teacher("001", "xiaoming", Subject.Math.getValue());
public static Teacher t2 = new Teacher("002", "lihua", Subject.Music.getValue());
public static Teacher t3 = new Teacher("003", "hanmeimei", Subject.Math.getValue());
public static Teacher t4 = new Teacher("004", "lihua", Subject.English.getValue());
public static List
Parents{id=‘3d9312eb-0df5-4ec6-998f-94a32c2253b4‘, name=‘LISI‘s Parent‘, chirldId=‘2‘, telNo=‘844668@qq.com‘}
Parents{id=‘7f0b92f5-872d-4671-982d-ef1b48840ce3‘, name=‘WANGWU‘s Parent‘, chirldId=‘3‘, telNo=‘563932@qq.com‘}
Parents{id=‘c318bffd-8c6d-4849-8109-9c686c97fb77‘, name=‘ZHAOLIU‘s Parent‘, chirldId=‘4‘, telNo=‘108022@qq.com‘}
Parents{id=‘a4ff1bbc-c9b6-4ad2-872c-f4df670c7bb6‘, name=‘TIANQI‘s Parent‘, chirldId=‘6‘, telNo=‘658956@qq.com‘}
public class Test {
public static void main(String[] args) {
List
文章标题:Java8Stream的flatmap方法使用
文章链接:http://soscw.com/index.php/essay/76605.html