Skip operation
Arul Dhesiaseelan
aruld at acm.org
Tue Sep 18 11:08:15 PDT 2012
Fair enough.
On Tue, Sep 18, 2012 at 7:51 AM, Brian Goetz <brian.goetz at oracle.com> wrote:
> While where we draw the line is still in flux, I think it is safe to say
> this is going to be over that line. The bar is not "include every feature
> anyone could imagine is useful" (we'd never ship, the cost of learning the
> API would be prohibitive, etc), but instead avoiding leaving out features
> that are truly essential.
>
> That said, enabling YOU to layer this sort of functionality atop the core
> streams abstractions is of course highly desirable.
>
>
> On 9/18/2012 1:34 PM, Arul Dhesiaseelan wrote:
>
>> Is there a plan to support skipWhile and takeWhile operations on the
>> stream, for example, loading orders from a csv dump that has markers for
>> orders?
>>
>> skipWhile(line -> line.startsWith("ORDERS BEGIN"))
>> .skip(1)
>> .takeWhile(line -> line.startsWith("ORDERS END")
>> .transform(line -> new Order(line))
>> .into(new ArrayList<Order>);
>>
>> -Arul
>>
>> On Tue, Sep 18, 2012 at 6:21 AM, Henry Jen <henry.jen at oracle.com> wrote:
>>
>>
>>> On Sep 18, 2012, at 3:01 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
>>>
>>> Hi Henry,
>>>>
>>>> On Sep 17, 2012, at 5:31 PM, Henry Jen <henry.jen at oracle.com> wrote:
>>>>
>>>> The patch looks good.
>>>>>
>>>>> At beginning I thought it to be a 'step' operation, then realize it's a
>>>>>
>>>> one-time skip operation.
>>>
>>>>
>>>>> Does it make sense to have a step operation as well?
>>>>>
>>>>
>>>> Can you give an example?
>>>>
>>>>
>>> countTo(10).step(1).sum() would be a sum of odd numbers.
>>>
>>> Useful when doing sampling.
>>>
>>>
>>>> Both skip and serial probably be serial only.
>>>>>
>>>>>
>>>> It might be possible to implement limit/skip in parallel, although i
>>>>
>>> admit to not currently knowing how :-)n , need to experiment. probably
>>> requires some way to cancel the creation of new F/J tasks and ones that
>>> are
>>> running.
>>>
>>> Agree. Without a predictable split, it would be challenging to step in
>>> parallel. :)
>>>
>>> Cheers,
>>> Henry
>>>
>>>
>>>
>>>
>>
More information about the lambda-dev
mailing list