Set<Student> students = stus.keySet();
for (Student key : students) {
String value = stus.get(key);
System.out.println(key.getName() + "," + key.getAge() + " " + value);
}
System.out.println("..........");
Set<Map.Entry<Student, String>> entries = stus.entrySet();
for (Map.Entry<Student, String> entry : entries) {
Student key = entry.getKey();
String value = entry.getValue();
System.out.println(key.getName() + "," + key.getAge() + " " + value);
}
|
|