hg: lambda/lambda/jdk: Convert extension methods to implmentation in the interfaces.
Rémi Forax
forax at univ-mlv.fr
Sat Dec 17 06:40:40 PST 2011
On 12/17/2011 03:01 PM, Colin Decker wrote:
> If you specified T because the compiler couldn't infer it, you could
> just specify the actual type T that the Iterable has and there will be
> no problem at all I would think.
code changed :)
Suppose you have a code like this
private void foo(ArrayList<CharSequence> list) {
...
filterMap<CharSequence>(list, ...);
...
}
and then you change the callsite and now it sends an ArrayList of String,
I think it's better to just change the signature of foo to
foo(ArrayList<String> list)
or foo(ArrayList<? extends CharSequence> list).
There is also another thing which is that the method signature offers
you free documentation,
by example, bar(Collection<? extends T>, Filter<? super T>), here I know
that the collection
taken as parameter is unlikely* to change.
>
> --
> Colin
Rémi
* it can change because you can insert null.
More information about the lambda-dev
mailing list