JAVA--keySet()的用法

package com.qf.Map;

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

public class Test2 {

public static void main(String[] args) {
	Map map = new HashMap();
	map.put("黄晓明", "杨颖");
	map.put("黄晓明", "哈哈");
	map.put("黄晓明", "哎");
	map.put("黄晓明", "杨颖");
	map.put("黄晓明", "颖");
	
	        Set set=  map.keySet();
	        Iterator it = set.iterator();
	        
	        while(it.hasNext()){
	        	String key=it.next();
	        	System.out.println(map.get(key));
	        }
}

}

你可能感兴趣的:(编程,JAVA,数据库,JAVA)