RFR: 8305486: Add split() variants that keep the delimiters to String and j.u.r.Pattern [v5]

Raffaello Giulietti rgiulietti at openjdk.org
Mon May 8 12:11:17 UTC 2023


On Mon, 8 May 2023 11:55:05 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Small optimization in private split().
>>   Added tests to compare String and Pattern implementations, in particular for one char regex.
>
> src/java.base/share/classes/java/lang/String.java line 3254:
> 
>> 3252:      *    <li> If the <i>limit</i> is positive then the pattern will be applied
>> 3253:      *    at most <i>limit</i> - 1 times, the array's length will be
>> 3254:      *    no greater than 2 · <i>limit</i> - 1, and the array's last
> 
> Hello Raffaello, when this is rendered, it looks like:
> 
> <img width="464" alt="centerdot" src="https://user-images.githubusercontent.com/143523/236816797-b8e0f64a-74a7-4d90-bf06-0350a023f24b.png">
> 
> I had to read up what `centerdot` is and from what I understand, it's used in mathematical notation for multiplication sign https://en.wikipedia.org/wiki/Interpunct#In_mathematics_and_science. 
> 
> However, I don't remember seeing similar usage in our API docs for multiplication symbol. I think, `*` has been widely(?) used in our API docs. Should we use `*` here too?
> 
> Same applies to the new javadoc on `Pattern` class.

The HTML named entity `·` is rendered correctly by the javadoc tool. However, IntelliJ IDEA currently does not recognize it (https://youtrack.jetbrains.com/issue/IDEA-316843). I could replace it by the equivalent `&#xB7;`, which is recognized by IDEA, but which is much less readable in source code.
So, unless there are other reason to prefer `*`, I'd like to stick with `·`.

WDYT?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13305#discussion_r1187369355


More information about the core-libs-dev mailing list