Iterator - Definition - Wrapper classes

Q.  Which allows the caller to remove elements from the underlying collection during the iteration with well-defined semantics?
- Published on 17 Jul 15

a. Enumeration
b. Iterator
c. None of the above

ANSWER: Iterator
 

    Discussion

  • Nirja Shah   -Posted on 15 Dec 15
    - Syntax
    public interface Iterator <E>

    - An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Framework. Iterators differ from enumerations in two ways:

    1. Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics.

    2. Method names have been improved.

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)