package org.hanqi.array;
import java.util.*;
public class Test3 {
public static void main(String[] args) {
// TODO 自动生成的方法存根
Map<String,String> m=new HashMap<String,String>();
m.put("0533", "淄博");
m.put("0531","济南" );
m.put("0532","青岛" );
System.out.println("长度="+m.size());
//m.put("0532","黄岛");
System.out.println("长度="+m.size());
m.put("0534", "青岛");
m.put(null, null);
System.out.println("长度="+m.size());
//根据Key获取value
System.out.println("0533="+m.get("0533"));
//Key是否存在
if(m.containsKey("0533"))
{
System.out.println("Key 0533已存在");
}
//value是否存在
if(m.containsValue("淄博"))
{
System.out.println("淄博已存在");
}
//遍历
for(String k:m.keySet())
{
System.out.println(k+"="+m.get(k));
}
}
}