Hi Stuart,
this change is pretty cool,

In the javadoc of Iterator instead of:
  Iterable<Permission> permsIterable = () -> pc.elements().asIterator();
one can write:
  Iterable<Permission> permsIterable = pc.elements()::asIterator;

and I wonder if an example with NetworkInterface.getNetworkInterfaces() is not better, I'm not sure a lot of people have to play with permissions outside people of this list.

and for the implementation of asIterator, I think the code can be written like this:
   default Iterator<E> asIterator() {
        return new Iterator<>() {
            @Override public boolean hasNext() {
                return hasMoreElements();
            }
            @Override public E next() {
                return nextElement();
            }
        };
    }

using diamond inference on inner-classes (I think the patch that allows that was integrated) and making calls to Enumeration.this implicit.

regards,
Rémi

On 05/16/2015 02:37 AM, 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