Test02.java
package junit.matrix.collections;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Test02 {
public static void main(String[] args) {
Map map = new HashMap();
map.put("id", 0301);
map.put("name", "Matrix");
map.put("salary", 33000);
map.put("department", "A");
map.put("hireDate", "2015-10");
Map map2 = new HashMap();
map2.put("id", 0301);
map2.put("name", "Matrix");
map2.put("salary", 33000);
map2.put("department", "B");
map2.put("hireDate", "2014-12");
Map map3 = new HashMap();
map3.put("id", 0301);
map3.put("name", "Matrix");
map3.put("salary", 33000);
map3.put("department", "C");
map3.put("hireDate", "2013-07");
List<Map> list = new ArrayList<Map>();
list.add(map);
list.add(map2);
list.add(map3);
}
public static void printEmpName(List<Employee> list) {
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i).getName());
}
}
}
运行结果:
Matrix
Tom
Ada
Jack