RFR(s): 8072726: add adapter to convert Enumeration to Iterator

Daniel Fuchs daniel.fuchs at oracle.com
Mon May 18 08:56:16 UTC 2015


Hi Stuart,

That's an RFE I have often wished for :-)

I've been wondering whether a static method
in the class java.util.Collections would be better, since there
already are some conversion methods there - like:

public static <T> Enumeration<T> emptyEnumeration();
public static <T> Enumeration<T> enumeration(final Collection<T> c);
public static <T> ArrayList<T> list(Enumeration<T> e);

but I see that Brian already commented in the bug that he
preferred the default method on Iterator...

I like the examples in the API documentation of the new method.
Looks good to me!

best regards,

-- daniel

On 16/05/15 02:37, Stuart Marks wrote:
> Hi all,
>
> Please review this small API enhancement to add a default method
> "asIterator()" to Enumeration that converts it into an Iterator.
>
> Webrev:
>
>      http://cr.openjdk.java.net/~smarks/reviews/8072726/webrev.0/
>
> Bug:
>
>      https://bugs.openjdk.java.net/browse/JDK-8072726
>
> Thanks,
>
> s'marks




More information about the core-libs-dev mailing list