if I want "id" is key and "name", "phoneNumber", "eamil" are values.
public class Personal {
private int id;
private String name;
private int phoneNumber;
private String email;
public Personal(int id){
this.id = id;
}
//getter and setter here
}
after input many person data. I can get data by id.
output ex: map.get(100001); // [Dan, 123456, [email protected]]
map.get(100002); // [Kim, 123343, [email protected]]
...
Question: What's the best ways to implement this HashMap ?
Thanks a lot!
HashMap<Integer, Personal>, and putting your instances of Personal class into the map?