package asp.map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
public class Map {
public static void main(String[] args) {
HashMap<String, Integer> map=new HashMap<>();
map.put("金海", 1);
map.put("小耳朵", 7);
map.put("铁林", 3);
map.put("长根", 6);
map.put("徐天", 5);
System.out.println(map);
int k=map.remove("徐天");
System.out.println(k);
System.out.println(map);
Integer s=map.get("金");
System.out.println(s);
Integer ss=map.get("金海");
System.out.println(ss);
boolean f=map.containsKey("铁林");
System.out.println(f);
boolean ff=map.containsValue(3);
System.out.println(ff);
Set<String> set=map.keySet();
Iterator<String> it=set.iterator();
while(it.hasNext())
{
String key=it.next();
Integer num=map.get(key);
System.err.println(num);
}
System.err.println("--------------");
for(String kString : set)
{
Integer num=map.get(kString);
System.err.println(num);
}
Set<Entry<String,Integer>> eeSet=map.entrySet();
Iterator<Entry<String,Integer>> itt=eeSet.iterator();
while(itt.hasNext())
{
Entry<String,Integer> entry=itt.next();
String sk=entry.getKey();
Integer y=entry.getValue();
System.err.println(sk+":"+y);
}
map.clear();
boolean ff1=map.isEmpty();
System.out.println(ff1);
}
}