incompatible types compile error

Arul Dhesiaseelan aruld at acm.org
Fri Nov 16 15:01:07 PST 2012


This works, btw.

List<Album> sortedFavs = new ArrayList<Album>();
albums.stream()
            .filter(a -> a.tracks.stream().anyMatch(t -> (t.rating >= 4)))
            .sorted(comparing((Mapper<Comparable, Album>) album ->
album.name))
            .into(sortedFavs);



On Fri, Nov 16, 2012 at 12:38 PM, Remi Forax <forax at univ-mlv.fr> wrote:

> On 11/16/2012 10:57 PM, Arul Dhesiaseelan wrote:
> > Hi,
> >
> > I am trying to run a slightly modified version from the latest State of
> the
> > Lambda libraries edition.
> >
> >      List<Album> sortedFavs =
> >          albums.stream()
> >              .filter(a -> a.tracks.stream().anyMatch(t -> (t.rating >=
> 4)))
> >              .sorted(comparing((Mapper<Comparable, Album>) album ->
> > album.name))
> >              .into(new ArrayList<Album>());
> >
> > java: incompatible types: java.util.stream.Stream.Destination cannot be
> > converted to java.util.List<Album>
> >
> > Any idea what could be wrong here?
>
> the signature of the method into.
>
> >
> > -Arul
> >
>
> Rémi
>
>
>


More information about the lambda-dev mailing list