兄弟,你要看的是keySet()方法返回的是什么类型 keySet() Returns a Set view of the keys contained in this Hashtable.然后你再看Set类有没有iterator()这个方法就明白了
jdk 里method如下 public Set keySet()可见keySet()返回的是set类型jdk里对set类型的Iterator 描述如下iterator public Iterator iterator() Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee). Specified by: iterator in interface Collection Returns: an iterator over the elements in this set.
keySet()
Returns a Set view of the keys contained in this Hashtable.然后你再看Set类有没有iterator()这个方法就明白了
public Iterator iterator()
Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee). Specified by:
iterator in interface Collection
Returns:
an iterator over the elements in this set.