public int compareTo(Object o) {
Doctor d = (Doctor)o;
return (doctor_name.compareTo(d.doctor_name));
}
这是我对博士学位的对比。
jTextArea.setText("");
int doctor_id = Integer.parseInt(jTextField2.getText());
String doctor_name = jTextField3.getText();
String hospitalName = jTextField4.getText();
Doctor d = new Doctor(doctor_id,doctor_name,hospitalName);
hmDoctor.put(doctor_id, d);
This is my hashmap
这是我的树图。
TreeMap<Integer,Doctor> tmDoctor = new TreMap<Integer,Doctor>(hmDoctor);
jTextArea.setText("");
Set keys = tmDoctor.keySet();
Iterator<Integer> ite = keys.iterator();
while(ite.hasNext())
{
int doctorID = ite.next();
Doctor d = tmDoctor.get(doctorID);
tmDoctor.put(doctorID, d);
jTextArea1.append(d.toString());
}
它没有医生的姓名。 为什么?