代码如下:
for (Iterator i = keys.iterator(); i.hasNext()
{
String key = (String) i.next();
String value = (String) map.get(key);
text+=key + " = " + value;
}
复制代码代码如下:
<span style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; font-size: 14px; white-space: normal;"><pre class="lang-java prettyprint"><span>
</span></pre>
</span>
或者
or (Map.Entry<String,String> entry : map.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
// do stuff
} Iterator<Entry<String, String>> iterator = map.entrySet().iterator();
复制代码代码如下:
Entry< String, String> entry;
while(iterator.hasNext()){
entry = iterator.next();
Log.d("Key Value",entry.getKey()+" "+entry.getValue());
}