遍历 HashMap简单的方式
/** * @author Bo年再无木小白 * @date 2013-11-07 */ import java.util.HashMap; import java.util.Iterator; import java.util.Set; public class HashSetTest { public static void main(String[] args) { HashMap map = new HashMap(); map.put("a", "aa"); map.put("b", "bb"); map.put("c", "cc"); map.put("d", "dd"); map.put("e", "ee"); Set set = map.keySet(); for(Iterator itr=set.iterator();itr.hasNext();){ String value =(String) itr.next(); String key = (String)map.get(value); System.out.println(value+"="+key); } } }
补充:软件开发 , Java ,