import java.util.*;
class MapDemo2
{
public static void main(String[] args)
{
Map<String,String> map=new HashMap<String,String>();
map.put("01","zhangsan1");
map.put("02","zhangsan2");
map.put("03","zhangsan3");
map.put("04","zhangsan4");
Set<Map.Entry<String,String>> entry=map.entrySet();
Iterator<Map.Entry<String,String>> it=entry.iterator();
while(it.hasNext())
{
Map.Entry<String,String> me=it.next();
String key=me.getKey();
String value=me.getValue();
System.out.println(key+"&&&"+value);
}
}
}
|
|