On Aug 19, 12:53 am, Kevin Bourrillion <
kev...@google.com> wrote:
> The wildcard on Lists.transform() was a mistake. It serves no useful
> purpose; all it accomplishes is that it allows the resulting list to be
> typed as a List<SuperFoo> instead of List<Foo>. But since nothing can be
> added to this list, there's almost no legitimate reason to want to do that,
> and one can always cast-and-suppress if that's actually what one needs.
>
> On Wed, Aug 18, 2010 at 3:02 PM, Olivier Michallat <
omichal...@gmail.com>wrote:
>
>
>
> > Hi all,
>
> > I've noticed a slight inconsistency between Collections2#transform and
> > Lists#transform: the first uses a "Function<? super F, T>", while the
> > latter uses a "Function<? super F, ? extends T>". Did I miss
> > something, or wouldn't it be better to have a consistent signature?
>
> > Allowing "? extends T" is more general, although it requires explicit
> > type parameters when the function returns a subtype:
>
> > Function<String, Integer> f = ...
> > List<String> input = ...
> > List<Number> output = Lists.<String, Number>transform(input, f);
>
> > Olivier
>
> > --
> >
guava-...@googlegroups.com.
> >
http://groups.google.com/group/guava-discuss?hl=en