On Wed, 31 Aug 2022 17:33:41 GMT, Nir Lisker <nlis...@openjdk.org> wrote:
>> modules/javafx.base/src/main/java/javafx/beans/value/ObservableValue.java >> line 311: >> >>> 309: * @since 20 >>> 310: */ >>> 311: default ObservableValue<T> when(ObservableValue<Boolean> >>> condition) { >> >> Discussion: name? `when`, `conditionOn`, other suggestions? Note that this >> is not the same as a possible future method `filter`, as a `filter` would >> still keep observing its source at all times (and would use a `Predicate` as >> parameter). > > `when` sounds fine, but we need to be careful about its relation to the > `When` class. > > This reminds me also that some of the new functionality in `ObservableValue` > can be used as a replacement for `When`, maybe we should note that like we > did with `Bindings.select`. Do you want me to make this part of the PR? Basically, `Bindings.when` with `map` or `flatMap` depending on whether or not you refer to a value or another property in `then` or `otherwise`. ------------- PR: https://git.openjdk.org/jfx/pull/830