Virtual extension methods -- a strawman design

Gernot Neppert mcnepp02 at googlemail.com
Mon May 17 02:45:00 PDT 2010


2010/5/17 Pavel Minaev <int19h at gmail.com>:
> On Mon, May 17, 2010 at 12:47 AM, Gernot Neppert <mcnepp02 at googlemail.com>
> wrote:
>>
>
> Similar reasoning is applicable to Collection#contains, Collection#isEmpty,
> Collection#toArray, List#get, List#indexOf, List#lastIndexOf - and probably
> more. Consequently, I'd expect all those to be lifted up to Iterable in
> conjunction with this proposal, with default implementations provided there.

Hmm, I definitely hope this won't happen ;-)

Iterable is quite useful as it is now. It's name conveys the purpose:
provide an iterator that can be used to implement for-style loops.
Why would you want to blur the distinction between Iterables and Collections?

Actually, this makes me fear a new trend: Will people move as many
methods as far 'upwards' as possible, providing more or less
meaningful default implementations?


More information about the lambda-dev mailing list