JDK
view plaincopy to clipboardprint?
<FONT color=#
Iterator it = map
while (it
Map
Object key = entry
Object value = entry
}</FONT>
Map map = new HashMap();
Iterator it = map
while (it
Map
Object key = entry
Object value = entry
}JDK
view plaincopy to clipboardprint?
Map m = new HashMap();
for(Object o : map
map
}
Map m = new HashMap();
for(Object o : map
map
}返回的 set 中的每個元素都是一個 Map
view plaincopy to clipboardprint?
<FONT color=#
private Hashtable<String
view plaincopy to clipboardprint?
<FONT color=#
Iterator it = emails
while(it
Map
(
}
// 方法二
for (Map
(
}
// 方法三
Iterator it = emails
while (it
String key;
key=(String)it
(
}
// 方法五
for(Object m: emails
(
}
</FONT>
//方法一: 用entrySet()
Iterator it = emails
while(it
Map
(
}
// 方法二
for (Map
(
}
// 方法三
Iterator it = emails
while (it
String key;
key=(String)it
(
}
// 方法五
for(Object m: emails
(
}
Map aa = new HashMap(); aa
來個完整的
view plaincopy to clipboardprint?
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<String>();
HashMap<Object
TreeMap<Object
list
list
list
hash
hash
hash
hash
hash
hash
treeMap
treeMap
treeMap
treeMap
treeMap
treeMap
//list遍歷
for(String m: list){
System
}
// hashmap entrySet() 遍歷
for(Map
System
}
//hashmap keySet() 遍歷
for(Object m: hash
System
}
// treemap keySet()遍歷
for(Object m: treeMap
System
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25783.html