flatMap signature
Remi Forax
forax at univ-mlv.fr
Tue Apr 2 07:28:19 PDT 2013
On 04/02/2013 04:05 PM, Boaz Nahum wrote:
> .
>
>> I also think that all Supplier<T> should be Supplier<? extends T>.
>>
>> But why ?
a Supplier<T> will return a T when get is called,
a Supplier<? extends T> will also return T when get is called
so it's always compatible to replace Supplier<T> by Supplier<? extends T>,
or said differently, Supplier is covariant.
cheers,
Rémi
> If S extends R:
>
> Supplier<S> ss = ..
>
> S s = stream.collect(ss,..,..)
>
> So also:
>
> R r = stream.collect(ss,)
>
> ?
>
> Thanks
> Boaz
>
More information about the lambda-dev
mailing list