edvin / tornadofx2

TornadoFX 2.0
Apache License 2.0
154 stars 40 forks source link

Split observableMapOf() into HashMap-based and LinkedHashMap-based #9

Open yevhenii-nadtochii opened 4 years ago

yevhenii-nadtochii commented 4 years ago

In Kotlin we have the next map-instantiation functions:

val kotlinMap = mapOf() // LinkedHashMap
val kotlinMutableMap = mutableMapOf() // LinkedHashMap
val kotlinHashMap = hashMapOf() // HashMap

And It would be great to have this in Tornadofx in order to keep coherence with Kotlin standard library:

val fxMap = observableMapOf() // now - HashMap, expected -LinkedHashMap
val fxHashMap = observableHashMapOf() // now - no such a function, expected - HashMap

It's definitely not a problem, but we are now used to it and I was expecting it exactly this way when used observable-instantiation functions first time. Now instantiating observable LinkedHashMap looks a bit boilerplating and doesn't meet neither Kotlin style nor Tornadofx's: LinkedHashMap<String, Int>().asObservable()

May be there are some reasons for that, but I just don't see any. Thank you!