private Map userList = new HashMap();
对userList进行了初始化
userList.put("1", new User("1","yonghu1","121","1@qq.com"));
userList.put("2", new User("2","yonghu2","122","2@qq.com"));
userList.put("3", new User("3","yonghu3","123","3@qq.com"));
然后下面这些代码什么意思
Iterator iterator = userList.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = iterator.next();
System.out.println(entry.getKey() + " " + entry.getValue().getUsername());
} |