On 05/18/2015 10:56 AM, Daniel Fuchs wrote:
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...

Hi Daniel,
I think we should do the opposite move, move the frequently used static methods from j.u.Collections to the interface their belong to. We have started this by moving Collections.sort() into List.sort() and we will soon add methods like of() to support 'collections literal' inside the collection interfaces. As Brian said, it's easier to find a method related to Enumeration inside Enumeration and j.u.Collections is already to big.

so it's like we should move the code of Collections.emptyEnumeration() into Enumeration.empty() and let's Collections.emptyEnumeration() to call Enumeration.empty().


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

best regards,

-- daniel

cheers,
Rémi


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


Reply via email to