Add destructuring operators to MapChangeListener#1146
Add destructuring operators to MapChangeListener#1146HoldYourWaffle wants to merge 1 commit intoedvin:masterfrom
Conversation
|
I'm not sure I agree the order is so arbitrary. Pretty much all change listeners in JavaFX use the order (observable, old, new), which would correspond to to ( Unfortunately that would make your example a little uglier: observableMap.addListener(MapChangeListener { (_, removed, added, key) ->
// exciting stuff
})But it would be more in line with JavaFX std-lib. |
|
Also, I'm not sure if it's still the case, but historically we would often not specify the return type when dealing with JavaFX collections and properties, and thus just pass the platform type up the line. It may be a little against the Kotlin way, but it means we aren't making assumptions for the user. For example, look at the delegation helpers for properties. |
|
I agree with @ruckustboom - the changelistener order should be maintained if we add this. Not sure of the value if we do though, as the example illustrates. |
|
Sorry for not responding for so long, but I just got back into TornadoFX and funnily stumbled into this again. If I understand correctly there are two changes I should make:
Would that be correct? |
I added destructuring operators to
MapChangeListenerto allow usage like this:This might be more controversial than #1141 since the order is relatively arbitrary (although it feels quite natural to me).
If this addition is not desired feel free to close this pull request, otherwise I should probably also add these operators to the other collection types' listeners.