當前位置:編程學習大全網 - 網站源碼 - list中放兩個map<string,object>類型的javabean

list中放兩個map<string,object>類型的javabean

給妳壹個參考的代碼:

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);

};

  • 上一篇:星球大戰123和4567有啥關系 主角都不壹樣了
  • 下一篇:瑞麗服裝cad打版怎麽刪除要素
  • copyright 2024編程學習大全網