The major difference between Enumeration and Iterator in java is that by using Enumeration, we can only traverse a Collection but by using Iterator, we can also remove an element while traversing the Collection.
There is no setSize() method or any other method in ArrayList which can manually set the increment size. 5. Enumerator Other than Hashtable ,Vector is the only other class which uses bothEnumeration and Iterator.While ArrayList can only use Iterator for traversing an ArrayList . 6. Introductio...
Since the Hashtable is thread-safe it is comparatively slower than the HashMap in the environment where Synchronization factor is not considered. HashMap can be traversed by using theiterator, whereas the Hashtable can be traversed by using enumerator and iterator. HashMap inherits AbstractMap class...
TraversingHashMap is traversed by Iterator.Like Map class Hashtable also does not directly support Iterator for traversing and hence, it uses Enumerator. Definition of HashMap HashMap is a class that implements theMapinterface and extends theAbstractMapclass uses the hash table. The HashMap’s obj...