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

Roger Riggs rriggs at openjdk.org
Tue May 9 14:25:20 UTC 2023


On Tue, 9 May 2023 09:21:08 GMT, Viktor Klang <duke at openjdk.org> wrote:

>> 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. :)

The switch from "a" to "the" was unintentional.  
"If a remaining element exists, the action is performed on it, returning true;..."

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

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


More information about the core-libs-dev mailing list