Diamond operator vs into

Brian Goetz brian.goetz at oracle.com
Fri Jan 4 08:38:25 PST 2013


We're hard at work on making this a temporary state!

(The problem is that diamond in nested generic method context ends up 
yielding typing constraints with inference variables on both sides.)

Though into() will likely go away in its current form, to be replaced 
with something more reduce-like (e.g., 
stream.accumulate(into(ArrayList::new)).

On 1/4/2013 11:32 AM, Michael Nascimento wrote:
> Hi guys,
>
> The diamond operator with into:
>
> public void aMethod(List<Entity> entities) {
>     List<Long> ids = entities.parallelStream().map(e ->
> e.getId()).into(new ArrayList<>());
> }
>
> Is this a temporary state or we will have to get back to fully using  generics?
>
> Regards,
> Michael
>


More information about the lambda-dev mailing list