On Tue, 11 Jan 2022 09:01:51 GMT, John Hendrikx <[email protected]> wrote:
> ```
> public final MultipleSelectionModel<T> getSelectionModel() {
> return selectionModel == null ? null :
> selectionModel.get() == NONE_SELECTION_MODEL ? null :
> selectionModel.get();
> }
> ```
That would work altough I think it's a bit hacky as when I listen on the
`selectionModelProperty` I still would get the noop selection model.
I'm in general not a fan of 'self-changing' properties. When a null value is
possible, guards against are needed.
Unfortunately there is no built-in way to forbid null in Java as whole.
> A check can also be done to see if something matches the `NONE` model, just
> like you can check for `null`, so you can still fast return in special cases.
But then I don't see any advantage as it makes no difference if we check for
NONE model or null. Checks are needed in any case.
-------------
PR: https://git.openjdk.java.net/jfx/pull/711