Enumeration adapters in SE 8

Paul Benedict pbenedict at apache.org
Wed Aug 24 13:54:23 PDT 2011


Another solution is for the JDK to add an Enumeration/Iterator adapter
class; then just instantiate it during compiler desugaring.

On Wed, Aug 24, 2011 at 3:34 PM, Stephen Colebourne
<scolebourne at joda.org> wrote:
> On 24 August 2011 19:10, Dan Smith <daniel.smith at oracle.com> wrote:
>> I was pointed to some comments on core-libs about adapting Enumerations to for loops in SE 8.  (Sorry for the new thread -- I wasn't subscribed.)  It turns out lambdas + extension methods will make this very easy.
>>
>> In the API:
>>
>> interface Enumeration<E> extends Iterator<E> {
>>  boolean hasMoreElements();
>>  E nextElement();
>>  boolean hasNext() default #hasMoreElements;
>>  E next() default #nextElement;
>>  void remove() default { throw new UnsupportedOperationException(); }
>> }
>
> This seems sensible.
>
> Is this made up syntax, or another EG decision?
>  void remove() default { throw new UnsupportedOperationException(); }
>
> Stephen
>
>


More information about the lambda-dev mailing list