package com.lideng.work322;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class MapDome1 {

	/**
	 * 利用增强for循环遍历集合
	 * @param args
	 */
	public static void main(String[] args) {
		
		HashMap<String, Integer> map=new HashMap<String, Integer>();
		map.put("张三", 22);
		map.put("李四", 21);
		
		HashMap<String, Integer> map1=new HashMap<String, Integer>();
		map1.put("王二", 20);
		map1.put("麻子", 26);

		
		Map<String, HashMap<String, Integer>> className=new HashMap<String, HashMap<String,Integer>>();
		className.put("女", map);
		className.put("男", map1);
		//集合放到set里面
		Set<Entry<String, HashMap<String, Integer>>> set=className.entrySet();
		
		//遍历set里面的键
		for (String entry : className.keySet()) {
			
			//遍历map里面的键
			for ( String entry1 :className.get(entry).keySet()) {
				// key:entry1 	value:className.get(entry).get(entry1)
				System.out.println("key  :"+entry1+"    value:"+className.get(entry).get(entry1));
			}
			
		
		}
		
	}

}