On Nov 8, 2013, at 10:56 PM, Xueming Shen <xueming.s...@oracle.com> wrote:

> On 11/08/2013 01:19 AM, Paul Sandoz wrote:
>> Hi Sherman.
>> 
>> When you say:
>> 
>> +     * of the stream. A zero-width match at the beginning however never 
>> produces
>> +     * such empty leading substring.
>> 
>> Is it possible to have a starting sequence of one or more zero-width matches?
> 
> The matcher.find() always increases its "next find start position" at least 
> one
> as showed in Matcher.find() impl ("first" starts from -1), so the 
> matcher.find()
> should keep going forward, never produce more than one zero-length substring.
> 

OK.


> Matcher:
>    public boolean find() {
>        int nextSearchIndex = last;
>        if (nextSearchIndex == first)
>            nextSearchIndex++;
>        ...
> 
> The webrev has been updated to use your optimized version in splitAsStream().
> 
> http://cr.openjdk.java.net/~sherman/8027645/webrev/

+1

I still think it would be useful to add a comment at the relevant code location 
about zero-width match behaviour.

Paul..

Reply via email to