On Feb 12, 2015, at 9:43 AM, Peter Levart <[email protected]> wrote:
> > 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() > I would prefer to stick with just one, given that it is very easy to reset the matcher, and the most common case is to start with a new matcher. Paul.
