发布日期:2009-10-11 7:05:20
遍历Map
import java.util.HashMap;
import java.util.Map;
public class test1 {
public static void main(String args[]) {
Map<String, String> map = new HashMap<String, String>();
map.put("1", "a");
map.put("2", "b");
for(Map.Entry<String, String> entry : map.entrySet()) {
System.out.println(entry.getKey() + " --> " + entry.getValue());
}
}
}