|What is difference between Enumeration and Iterator?
||It is legacy interface and introduced in 1.0 version.
||It is non-legacy and introduced in 1.2 version.
||Applicable only for legacy classes and it is not universal
||Applicable for any Collection implemented class object.
||While iterating the elements we are not allowed to remove
the objects just we can perform only read operation.
||While iterating we can perform removal also in addition
to read operation.
||By using elements() method we can get Enumeration object.
||By using iterator() method we can get Iterator object.
What are limitations of Enumeration?
While iterating the elements we are not allowed to perform
It is applicable only for legacy classes and it is not a
It can retrieve the elements only in forward direction.
What is difference between enum and Enumeration?
An enum can be used to define a group of named constants.
It has introduced in 1.5 version
Enumeration is cursor to retrieve Objects one by one from
What is difference between Iterator and ListIterator?
ListIterator is the child interface of the Iterator
Iterator is the single direction cursor where as ListIterator
is bidirectional cursor.
While iterating the elements by Iterator we can perform only
read and remove operations. But by using ListIterator we can perform read,removal,
replace and addition of new objects also.
Iterator is applicable for every Collecton implemented class
object but ListIterator is applicable only for List implemented class
Iterator can be get by using iterator() of Collection interface
where as ListIterator can be get by using listIterator() method of List
both are introduced in 1.2 version
What is relation between ListIterator and Iterator?
ListIterator is child interface of Iterator