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

Daniel Fuchs daniel.fuchs at oracle.com
Tue May 19 16:13:52 UTC 2015

On 19/05/15 12:07, Paul Sandoz wrote:
>> Should anything be said also about default remove() method inherited from Iterator interface? Are custom asIterator() implementations allowed to return an Iterator that implements remove() in a way that actually removes elements?
>> >
> Since this method transfers control it seems a little mean to place such a restriction on the returned Iterator. Although, there is no clear means of stating to the caller whether such an iterator supports removal or not, but that seems to be generally the case for any Iterator returning method.

Ah... Interesting use case. I hadn't thought of that.

What should ConcurrentHashMap.keys().asIterator().remove() do?


-- daniel

More information about the core-libs-dev mailing list