zake
01/28/2018, 6:14 AMclass Foo {
val bar = mutableListOf<Bar>()
get() {
return listOf(*bar.toTypedArray())
}
}
?
It would seem that the only way is to really just do
val bar = mutableListOf<Bar>()
...
fun getBar(): List<Bar> = bar
, but the result is that it you get two getters with the same signature on the JVM
Update:
If you just add the @JvmField
decorator, you don’t have to deal with that, but is there a way to do it as closely to the top idea? Because you can still just get the mutableList as a property apparently
Update:
Backing the field is probably the solution.Joshua F
01/28/2018, 6:25 AM