Raw types warning
Brian Goetz
brian.goetz at oracle.com
Thu Apr 18 13:51:24 PDT 2013
OK, merge the map/flatMap as I suggested (ignoring the suggestion about
the stream source) and I suspect your problem will go away.
On 4/18/2013 4:47 PM, Michael Nascimento wrote:
> On Thu, Apr 18, 2013 at 5:45 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>> That's going pretty roundabout...
>>
>> How about:
>>
>> hqIds.stream()
>> .map(id -> findDealer(id))
>> .flatMap(d -> d.getBranches().stream())
>> .collect(toList());
>>
>> No reason to create intermediate garbage List<Dealer> if you can efficiently
>> map from id to Dealer.
>
> Except it hits the database multiple times instead of just one :-)
>
> I wonder about the raw types warning though.
>
> Regards,
> Michael
>
More information about the lambda-dev
mailing list