foreach/filter/map/reduce on Iterable & Iterators
Craig P. Motlin
cmotlin at gmail.com
Thu Sep 15 19:47:43 PDT 2011
That's very interesting - I didn't know about the inconsistency within
Guava. I tried refactoring my codebase to eliminate the "? extends" and to
my surprise, there were no breaks. However, it's still not clear to me what
the benefit is. Does type inference work better? I couldn't find any
examples where it does. If the only argument is that it's really rare to
need that kind of flexibility, I don't think that's a very good reason to
drop it.
On Thu, Sep 15, 2011 at 11:50 AM, Rémi Forax <forax at univ-mlv.fr> wrote:
> On 09/15/2011 04:46 PM, Colin Decker wrote:
> > Also, you can pass a Mapper<? super MyType, ? extends MyOtherType> to
> map
> > even if it takes Mapper<? super T, U>. The result is just going to be an
> > Iterable<? extends MyOtherType>. That is the actual type of the resulting
> > Iterable and it's no less usable than if you called it an
> > Iterable<MyOtherType>.
>
> true for Iterable not for Collection,
> and why the hell do you want to write wildcards in the user code.
> The idea is to use wildcards in the API code to don't bother the user.
>
> Rémi
>
>
>
More information about the lambda-dev
mailing list