Hi Paul, my apology for taking so long :-)
The change looks fine.
With regarding the edge case "".split(""), I am fine with the idea of
discarding the
resulting empty string as one trailing empty string.
-Sherman
On 01/20/2015 08:17 AM, Paul Sandoz wrote:
Hi,
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8069325-Pattern-splitAsStream-emptyInput/webrev/
This patch fixes an edge case in Pattern.splitAsStream for matching against an
empty input string, which deviated from the behaviour of Pattern.split. When
there are no matches a stream containing the input string should be returned
rather than an empty stream.
--
I have kept compatibility with Pattern.split(String ) but i noticed another an
edge case.
What should the following return:
Pattern.compile("").split("")
[] or [""]?
There is a zero-width match at the beginning and an empty remaining segment both of which
should be discarded, as such i would expect the result to be [] rather than as
[""], as currently produced result.
If people agree that this is an issue i suggest we log a new one independent of
fixing 8069325.
Thanks,
Paul.