RFR: JDK-8133773: clarify specification of Spliterator.tryAdvance [v2]

Viktor Klang duke at openjdk.org
Tue May 9 09:24:24 UTC 2023


On Mon, 8 May 2023 21:00:32 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Viktor Klang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update src/java.base/share/classes/java/util/Spliterator.java
>>   
>>   Co-authored-by: Paul Sandoz <paul.d.sandoz at googlemail.com>
>
> src/java.base/share/classes/java/util/Spliterator.java line 298:
> 
>> 296: public interface Spliterator<T> {
>> 297:     /**
>> 298:      * If a remaining element exists: performs the given action on it,
> 
> I'm not sure the ":" is an improvement on the ",". 
> "If the remaining element exists, the action is performed on it, ..."

@RogerRiggs "the" instead of "a" gives me the impression that the Spliterator only has a single element left. The choice of colon instead of a comma is because "If a remaining element exists" introduces a list of 2 elements (and introducing a list is a good place for a colon) whereas the "else returns {@code false}" is a closely connected sentence to the topic of the list, which seems like a place to use the semi-colon.

But, not being a native English-speaker, I will happily change it to something which is more correct. :)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13860#discussion_r1188369217


More information about the core-libs-dev mailing list