On Thu, 9 Nov 2023 09:33:54 GMT, Viktor Klang <vkl...@openjdk.org> wrote:
>> src/java.base/share/classes/java/util/stream/Gatherer.java line 261: >> >>> 259: /** >>> 260: * Returns an initializer which is the default initializer of a >>> Gatherer. >>> 261: * The returned initializer identifies that the owner Gatherer is >>> stateless. >> >> I know the text is logically correct but is there a way to be more >> intuitively correct? I mean, there are other initializers that could also >> mean the Gather is stateless. > > @minborg Not really, from an evaluation-perspective only this specific > initializer indicates true statelessness (other instances will signal that it > is stateful even if it happens to use `null` as its state). True > statelessness means that the initializer doesn't need to be invoked, and that > any state does not need to be tracked. Then it should read something that "if, and only if" >> src/java.base/share/classes/java/util/stream/Gatherer.java line 419: >> >>> 417: * @return the new {@code Gatherer} >>> 418: */ >>> 419: static <T, R> Gatherer<T, Void, R> of( >> >> Nit: In `Collector` the parameters are formatted in a different way. Should >> we be consistent with that existing formatting? > > Which parameters? The type parameters or the method parameters? Here is an example: static<T, A, R> Collector<T, A, R> of(Supplier<A> supplier, BiConsumer<A, T> accumulator, BinaryOperator<A> combiner, Function<A, R> finisher, Characteristics... characteristics) { ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1387941646 PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1387942446