RFR 8071479: Stream and lamdification improvements to j.u.regex.Matcher
Paul Sandoz
paul.sandoz at oracle.com
Mon Mar 2 09:49:07 UTC 2015
On Feb 28, 2015, at 4:40 AM, Xueming Shen <xueming.shen at oracle.com> wrote:
> Updated to a static private class for the toMatchResult(). Added a private field MatchResult for the anonymous MatchResult
> wrapper.
>
> http://cr.openjdk.java.net/~sherman/regex.stream/src/java.base/share/classes/java/util/regex/Matcher.java.sdiff.html
>
Many thanks, i took most of that code and updated:
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8071479--Matcher-stream-results/webrev/src/java.base/share/classes/java/util/regex/Matcher.java.sdiff.html
- additional documentation for replacer function parameter is moved to the main body
- there is no need for an internal MatchResult instance wrapper. It does not protect against state modification, does not protect against escape, creates another object for all matcher instances, and results in more wrapping. The only way we can avoid the first 2 is by using an immutable match result, which has it's own cost that unfortunately we cannot avoid in the results().
Paul.
More information about the core-libs-dev
mailing list