< prev index next >

src/java.base/share/classes/java/util/Iterator.java

Print this page

        

*** 21,33 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package java.util; ! import java.util.function.Consumer; /** * An iterator over a collection. {@code Iterator} takes the place of * {@link Enumeration} in the Java Collections Framework. Iterators * differ from enumerations in two ways: --- 21,34 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package javany.util; ! import java.util.Objects; ! import javany.util.function.Consumer; /** * An iterator over a collection. {@code Iterator} takes the place of * {@link Enumeration} in the Java Collections Framework. Iterators * differ from enumerations in two ways:
*** 49,59 **** * @see Collection * @see ListIterator * @see Iterable * @since 1.2 */ ! public interface Iterator<E> { /** * Returns {@code true} if the iteration has more elements. * (In other words, returns {@code true} if {@link #next} would * return an element rather than throwing an exception.) * --- 50,60 ---- * @see Collection * @see ListIterator * @see Iterable * @since 1.2 */ ! public interface Iterator<any E> { /** * Returns {@code true} if the iteration has more elements. * (In other words, returns {@code true} if {@link #next} would * return an element rather than throwing an exception.) *
*** 63,73 **** /** * Returns the next element in the iteration. * * @return the next element in the iteration ! * @throws NoSuchElementException if the iteration has no more elements */ E next(); /** * Removes from the underlying collection the last element returned --- 64,74 ---- /** * Returns the next element in the iteration. * * @return the next element in the iteration ! * @throws java.util.NoSuchElementException if the iteration has no more elements */ E next(); /** * Removes from the underlying collection the last element returned
< prev index next >