RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)
Rémi Forax
forax at openjdk.org
Wed Nov 8 17:39:05 UTC 2023
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang <vklang at openjdk.org> wrote:
> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461)
src/java.base/share/classes/java/util/stream/GathererOp.java line 95:
> 93: public void accept(X x) {
> 94: final var b = rightMost;
> 95: (b == null ? (rightMost = new NodeBuilder.Builder<>()) : b).accept(x);
I think this code is unecessarily hard to read.
var rightMost = this.rightMost;
if (rightMost == null) {
rightMost = this.rightMost = new NodeBuilder.Builder<>();
}
rightMost.accept(x);
src/java.base/share/classes/java/util/stream/GathererOp.java line 99:
> 97:
> 98: public NodeBuilder<X> join(NodeBuilder<X> that) {
> 99: if (isEmpty())
Please add curly braces around if and if/else
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1386982341
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1386984238
More information about the core-libs-dev
mailing list