SimpleMapProperty<String, String> map = new SimpleMapProperty<>(FXCollections.observableHashMap());
Add several change listeners and modify the map. Nothing happens.
Example code attached.
Expected output:
Map Listener 1
Map Listener 2
Map Listener 3
Boolean Listener 1
Boolean Listener 2
Boolean Listener 3
Actual:
Boolean Listener 1
Boolean Listener 2
Boolean Listener 3
If any 2 of 3 map listeners are commented out, remaining single listener works. All 3 boolean property listeners work fine.
Workaround is to bind another SimpleMapProperty and add listener there. This trick works as many times as required.
Add several change listeners and modify the map. Nothing happens.
Example code attached.
Expected output:
Map Listener 1
Map Listener 2
Map Listener 3
Boolean Listener 1
Boolean Listener 2
Boolean Listener 3
Actual:
Boolean Listener 1
Boolean Listener 2
Boolean Listener 3
If any 2 of 3 map listeners are commented out, remaining single listener works. All 3 boolean property listeners work fine.
Workaround is to bind another SimpleMapProperty and add listener there. This trick works as many times as required.
- duplicates
-
JDK-8173987 One and only one change listener works for MapPropertyBase<K,V>
- Closed