package com.hanqi;
import java.util.ArrayList;
import java.util.HashMap;import java.util.HashSet;import java.util.Iterator;import java.util.Map;import java.util.Set; public class list {public static void main(String[] args) {
Map map = new HashMap(); Emp emp = new Emp("005","小明"); Emp emp1 = new Emp("006","小张"); Emp emp2 = new Emp("007","小王"); HashMapmap1 = new HashMap (); map1.put(emp.getId(), emp.getName()); map1.put(emp1.getId(), emp1.getName()); map1.put(emp2.getId(), emp2.getName()); System.out.println(map1); map1.remove("005"); System.out.println(map1);
package com.hanqi;public class Emp { /*public Emp(String string, String string2) { }*/ private String id; private String name; public Emp(String id, String name) { super(); this.id = id; this.name = name; }public String getId() { return id;}public void setId(String id) { this.id = id;}public String getName() { return name;}public void setName(String name) { this.name = name;} }