给你看个把HashMap转换为Iterator的例子:
HashMap hashMap = queryForm.getValue();
Iterator it = hashMap.keySet().iterator();
while (it.hasNext()) {
String key = (String)it.next();
String value = (String)hashMap.get(key);
...
}
iterator只是一种接口,是一种遍历(思维)方式,不能使所有container的遍历都用一个method搞定,因为container所包含的elements类型多种多样,而你在遍历的过程中要处理这些elements
HashMap hashMap = queryForm.getValue();
Iterator it = hashMap.keySet().iterator();
while (it.hasNext()) {
String key = (String)it.next();
String value = (String)hashMap.get(key);
...
}
iterator只是一种接口,是一种遍历(思维)方式,不能使所有container的遍历都用一个method搞定,因为container所包含的elements类型多种多样,而你在遍历的过程中要处理这些elements