RFR 8071479: Stream and lamdification improvements to j.u.regex.Matcher

Peter Levart peter.levart at gmail.com
Thu Feb 12 08:43:34 UTC 2015


On 02/11/2015 08:23 PM, Stuart Marks wrote:
>> 1.1) Change the specification of Matcher.results to reset the stream 
>> before matching, making it consistent with the replace* methods.
>
> I'm not sure about this. The current replaceAll/replaceFirst methods 
> reset the matcher before doing any matching, so the lambda-based 
> overloads should do the same.
>
> However, the model for
>
>     Stream<MatchResult> results()
>
> seems to me to be a stream of matches that would be returned by 
> successive calls to find(). (Indeed, that's how it's implemented.) The 
> no-arg find() call doesn't reset the Matcher, and it respects the 
> existing region of the Matcher. I think results() should do the same. 

Hi,

What about two methods?

Stream<MatchResult> remainingResults(); // doesn't reset the Matcher
Stream<MatchResult> [all]results(); // resets Matcher and calls 
remainingResults()


Peter




More information about the core-libs-dev mailing list