模拟测试:
//怎样将一个集合里面的数据按照某个参数进行分类?
public static void main(String[] args) {
//假设有个学生的实体类 Student.class
//定义几个不同的学生
Student stu1 = new Student(1, "小明", "小学(1)班", 6, "男");
Student stu2 = new Student(2, "Suny", "小学(2)班", 7, "男");
Student stu3 = new Student(3, "小花", "小学(3)班", 7, "女");
Student stu4 = new Student(4, "Tony", "小学(3)班", 5, "女");
Student stu5 = new Student(5, "Hello", "小学(3)班", 7, "女");
Student stu6 = new Student(6, "小红", "小学(2)班", 7, "女");
//定义一个集合存放学生
List<Student> students = new ArrayList<>();
students.add(stu1);
students.add(stu2);
student