I have a HashMap which holds studentIds as key and student objects as values,
HashMap<Integer, Student> hashMap = hashTables.buildHash(students);
public static HashMap<Integer, Student> buildHash(Student[] students) {
HashMap<Integer, Student> hashMap = new HashMap<Integer, Student>();
for (Student s : students) hashMap.put(s.getId(), s);
return hashMap;
}
the below code gets each KeyValue pair and s.getValue() returns a student object which is comprised of an id and an string name, how can i retrieve/print those values (student.int, student.name);
for(Map.Entry s : hashMap.entrySet())
System.out.print(s.getKey()+" "+s.getValue());