Concatenated observable lists
Michael Strauß
michaelstrau2 at gmail.com
Wed Apr 12 07:26:07 UTC 2023
The JavaFX collections framework offers the
`FXCollections.concat(ObservableList...)` method, which creates a new
modifiable list that contains a concatenated snapshot of the source
lists, backed by an `ArrayList`. However, when the source lists are
changed, the concatenated list is not updated.
I propose to add
`FXCollections.concatenatedObservableList(ObservableList...)`, which
creates an unmodifiable collection view onto the source lists that
represents the concatenation of all source elements. When any of the
source lists are changed, the change is also reflected in the
concatenated view.
This would add a useful capability to the JavaFX collections framework
which has been requested a number of times [0] [1], and is currently
only available via a third-party library [2].
A draft PR is available here: https://github.com/openjdk/jfx/pull/1087
[0] https://stackoverflow.com/questions/37524662/how-to-concatenate-observable-lists-in-javafx
[1] https://bugs.openjdk.org/browse/JDK-8164626
[2] https://github.com/tobiasdiez/EasyBind#concat-lists-of-observable-lists
More information about the openjfx-dev
mailing list