JavaFx: merge boolean properties

261 views Asked by At

I have a List<BooleanProperty>, how can I merge them with or?

I need something like:

private BooleanProperty getMergedProperty(List<BooleanProperty> properties){
     return mergeAllWithOr(properties);
}

Or:

private BooleanBinding getMergedBinding(List<BooleanProperty> properties){
     return mergeAllWithOr(properties);
}

mergeAllWithOr means list.get(0).or(list.get(1)).or(...

Edit: This is what I have tried, but it works as an and not an or:

private BooleanProperty getMergedProperty(List<BooleanProperty> properties) {
    BooleanProperty property = new SimpleBooleanProperty();
    properties.forEach(property::bind); // or donesn't work at all.
    return property;
}

Can you please suggest any solution?

0

There are 0 answers