Usage of Stream::peek in Project

dev.infeo at dev.infeo at
Fri Sep 3 09:27:14 UTC 2021

Hey all,

recently I stumbled over the problem of non-executing stream operations, especially `Stream.peek(Consumer<? super T> action)`, for more Info see [1]. With JDK 17 this behaviour is even extended (e.g. skip() preserves the SIZED attribute of a stream, making optimizations possible).

Out of curiosity I searched the sources at HEAD of peek(...) usages and found two problematic classes:
* javafx.scene.control.MultipleSelectionModelBase: Line 745
* javafx.scene.control.ControlsUtil: Line 165 & 171

Especially the statement around line 171 in ControlsUtil is a candidate which might be "optimized" to not execute the peek(...) at all, while the inline comment states the call to peek is crucial.

I don't know what the roadmap says about updating to JDK17, but it might already be a problem and I wantend to raise attention to this.

Best Regards,


More information about the openjfx-dev mailing list