HashMap listMap1 = new HashMap();
for (int i = 0; i < 3; i++) {
MyClass class1=new MyClass();
class1.setClassID(i+1);
class1.setClassName("班級"+(i+1));
ArrayList list = new ArrayList();
int count=(int) (Math.random() * 7)+1;
for (int j = 0; j < count; j++) {
Student student = new Student();
student.setStuId(j+1);
student.setStuName(class1.getClassName()+"學員" + (j+1));
student.age = (int) (Math.random() * 70);
list.add(student);
}
listMap1.put(class1, list);
};