map 理解

键值对

map会将同名的值覆盖掉

public static void main(String[] args) {
  Map<String,String> maptest=new HashMap<String,String>();
  maptest.put("hello", "你好!");
  System.out.println("maptest=>"+maptest);
  maptest.put("hello", "world");
  System.out.println("maptest=>"+maptest);
  System.out.println(maptest.get("hello"));
}

原文地址:https://www.cnblogs.com/austinspark-jessylu/p/6136496.html