Map 循环出key 和 value

package com.cwises.action.purchase;

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

public class test {

public static void main(String[] args) {
Map<String,Object> map=new HashMap<String,Object>();
map.put("1",123123);
map.put("2",123123);
map.put("3",123123);

Iterator<Entry<String, Object>> iterator = map.entrySet().iterator();

Entry<String, Object> entry;
while(iterator.hasNext()){
entry = iterator.next();
System.out.println("Key Value "+entry.getKey()+" "+entry.getValue());
}

}

}

posted @ 2015-04-01 11:14  joycelishanhe  阅读(294)  评论(0编辑  收藏  举报