Luc Duponcheel luc.duponcheel at gmail.com
Fri Feb 1 08:22:58 PST 2013


thanks so much

it is always a bit tricky to know which methods are for
app developers and which ones are for lib developers

I worked with the parallel stream alternative already
( but was intrigued by the spliterator as well :-) )

Luc


On Fri, Feb 1, 2013 at 4:33 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

> It "just works", but it doesn't try to split ;)
>
> Spliterator is NOT a parallel execution framework.  It is the low-level
> adapter type that lets an arbitrary data structure (array, List, whatever)
> feed data into a parallel execution framework.  Think of it as the parallel
> analogue of Iterator, but the framework has to decide when to split.
>
> Spliterator is not meant for most devs to use; only for developers of
> library-based aggregates.  EVeryone else will do:
>
>   list.parallelStream().forEach(**...)
>
> and get what you are looking for.
>
>
> On 2/1/2013 10:14 AM, Luc Duponcheel wrote:
>
>> Hello,
>>
>> I have a (hopefully) very simple question about spliterators
>>
>> consider something like
>>
>>    Spliterator<Integer> spliterator =
>>     // ... make a spliterator
>>
>>    spliterator.forEach(integer ->
>>      new Integer(integer.intValue() + 1)
>>     );
>>
>> does the foreach method "just work"
>> (I mean: will it try to split)
>>
>> or do I somehow have to invoke the trySplit() method myself
>>
>> thx
>>
>> Luc
>>
>>


-- 
   __~O
  -\ <,
(*)/ (*)

reality goes far beyond imagination


More information about the lambda-dev mailing list