java容器根据接口实现的接口可以分为Collection和Map两大类。
其中包含了两大接口
接口与类的关系图如下:

Map接口的实现类主要包含HashMap,TreeMap,LinkedHashMap,Properties等
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class helloWorld {
    public static void main(String[] args) {
     Map<Integer,Integer> map = new HashMap<Integer,Integer>();
     Map<Integer,Integer> mapcopy = new HashMap<Integer,Integer>();
     map.put(1,2);                  //插入映射
     map.put(2, 4); 
     map.get(1);                        //根据key,获取value
     System.out.println(map.get(1));
     if(map.containsKey(1)){            //判断是否存在key 1
            System.out.println();
     }  
     if(map.containsValue(1)){      //判断是否存在value 1
        System.out.println(1);
    }
     map.remove(1);                 //清除key为1的映射关系
     map.clear();                   //清除所有映射关系
     map.putAll(mapcopy);           //复制映射关系
     map.size();
     map.entrySet();
     
 } 
}
原文:https://www.cnblogs.com/a1225234/p/10278276.html