IntStream and collect

Jose jgetino at
Mon May 13 08:43:30 PDT 2013

Yes, I don't care boxing the structure (byte[], short[], int[], BitSet). 

But I don't want to box all the ints, there might be the order 10^5 in a
typical case. 
The second boxing level is much more expensive.


-----Mensaje original-----
De: Brian Goetz [mailto:brian.goetz at] 
Enviado el: lunes, 13 de mayo de 2013 17:12
Para: Jose
CC: lambda-dev at
Asunto: Re: IntStream and collect

If we did that, I suspect that about 5 minutes later, you'd find you still
need classes like IntArrayList, IntIntHashMap, etc, to get anywhere.  We
prototyped a Collector.OfInt and found there were almost no implementations
to be offered by the JDK.  Since the JDK options you've got mean boxing
anyway, a Collector.OfInt would only push the boxing one level down.

On 5/13/2013 6:13 AM, Jose wrote:
> Paul,
> I'm interested on data structures that stores a great number of ints 
> (cordinates of polylines) in a efficient way.
> They might include byte[], short[], int[] based structures similar to 
> nio buffers.
> Some of them store the delta with respect to the previous  entry, 
> others with respect a common origin.
> Im also intereseted on Bitset based structures, assigning n bits for 
> each entry.
> These structures already have a stream() method, and I would like they 
> would implement  "IntCollector" as well.

More information about the lambda-dev mailing list