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

Claes Redestad claes.redestad at oracle.com
Sat May 16 16:21:23 UTC 2015


Hi,

any reason not to just have Enumeration extend Iterable and 
default-implement iterator()?

http://cr.openjdk.java.net/~redestad/scratch/enumerable.00/

I guess there are compatibility risks I haven't thought through 
completely, but I
think concrete classes that already implement both Enumeration and 
Iterable should
continue to work as expected (since the concrete class' implementation of
iterator always takes precedence), no?

/Claes

On 2015-05-16 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