Regex Point Lambdafication Patch
Remi Forax
forax at univ-mlv.fr
Wed Mar 13 04:31:37 PDT 2013
On 03/13/2013 11:51 AM, Paul Sandoz wrote:
> Hi Ben,
>
> On Mar 12, 2013, at 10:33 PM, Ben Evans <benjamin.john.evans at gmail.com> wrote:
>
>> Thanks Brian.
>>
>> Does this webrev address the current comments?
>>
>> http://www.java7developer.com/webrev-kittylyst.002/
>>
> Can you include Spliterator.NONNULL in the characteristics since I presume input.subSequence will never return a non-null value?
>
> A useful pattern when writing iterators is to do:
>
> T next() {
> if (!hasNext()) throw NoSuchElementException();
> ...
> }
>
> so hasNext() when returning true sets up the correct state for next() to obtain the next element e.g.:
>
> CharSequence next() {
> if (!hasNext()) throw NoSuchElementException();
>
> return input.subsequence(start, end);
> }
>
> Once that works once can decide if it is worth optimizing the implementation.
If the Iterator has no subclass, which is often the case, then the VM
will do the inlining for you,
so cases where it worth 'optimizing' by hand this kind of code are rare.
> Paul.
>
Rémi
More information about the lambda-dev
mailing list