< prev index next >

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

Print this page

        

*** 86,106 **** * are called on this enumeration after the call to {@code asIterator}. * * @apiNote * This method is intended to help adapt code that produces * {@code Enumeration} instances to code that consumes {@code Iterator} ! * instances. For example, the {@link java.util.jar.JarFile#entries * JarFile.entries()} method returns an {@code Enumeration<JarEntry>}. * This can be turned into an {@code Iterator}, and then the * {@code forEachRemaining()} method can be used: * * <pre>{@code * JarFile jarFile = ... ; * jarFile.entries().asIterator().forEachRemaining(entry -> { ... }); * }</pre> * ! * (Note that there is also a {@link java.util.jar.JarFile#stream * JarFile.stream()} method that returns a {@code Stream} of entries, * which may be more convenient in some cases.) * * @implSpec * The default implementation returns an {@code Iterator} whose --- 86,106 ---- * are called on this enumeration after the call to {@code asIterator}. * * @apiNote * This method is intended to help adapt code that produces * {@code Enumeration} instances to code that consumes {@code Iterator} ! * instances. For example, the {@link java.util.jar.JarFile#entries() * JarFile.entries()} method returns an {@code Enumeration<JarEntry>}. * This can be turned into an {@code Iterator}, and then the * {@code forEachRemaining()} method can be used: * * <pre>{@code * JarFile jarFile = ... ; * jarFile.entries().asIterator().forEachRemaining(entry -> { ... }); * }</pre> * ! * (Note that there is also a {@link java.util.jar.JarFile#stream() * JarFile.stream()} method that returns a {@code Stream} of entries, * which may be more convenient in some cases.) * * @implSpec * The default implementation returns an {@code Iterator} whose
< prev index next >