package jihe;
public class Emp {
private String id;
private String name;
public String getId()
{
return id;
}
public String getName()
{
return name;
}
public Emp(String id,String name)
{
this.id = id;
this.name = name;
}
}
HashMap<String,String> hm = new HashMap<>();
Emp emp = new Emp("001","aaa");
hm.put(emp.getId(), emp.getName());
emp = new Emp("002","bbb");
hm.put(emp.getId(), emp.getName());
emp = new Emp("011","ccc");
hm.put(emp.getId(), emp.getName());
emp = new Emp("015","ddd");
hm.put(emp.getId(), emp.getName());
emp = new Emp("019","eee");
hm.put(emp.getId(), emp.getName());
hm.remove("015");
Set<String> S = hm.keySet();
for(String s4 : S)
{
System.out.println("Key:" + s4 +" Value:" + hm.get(s4));
}