Mapputとremoveの使用

567 ワード


import java.util.HashMap;
import java.util.Map;


public class TestDemo {
public static void main(String[] args) {
	Map map = new HashMap();  
    Integer it = map.put("id", new Integer(1));  
    Integer it1 = map.put("id", new Integer(333)); 
    Integer it2 = map.remove("id"); 
    //        id      ,       id,       null  
    //        id    ,           id  ,                          
    //map remove    key   value
    System.out.println(it);  
    System.out.println(it1);
    System.out.println(it2);
}
}