rdgoite07/15/2019, 2:32 PM
is called. However, I just found out that defining something like,
is problematic because calling
var myCollection: MutableList<String> = mutableListOf() private set get() = field.toMutableList()
within the class itself seem to call the getter instead. My current alternative is to make it immutable collection and replace it every time there are changes. However, that seems to be a little more work than it should be. Any ideas?
Shawn07/15/2019, 2:34 PM
private val _list = mutableListOf<Any>() public val list: List<Any> private set get() = _list
rdgoite07/15/2019, 2:50 PM