is it pretty common for people to have there own m...
# getting-started
c
is it pretty common for people to have there own mutable types for private use in a system, then having a immutable version of the same type for exposing that object publicly?
s
Android ViewModel uses this pattern
Copy code
class MainViewModel : ViewModel() {

    val valuesLiveData : LiveData<Int>
        get() = mutableLiveData

    private val mutableLiveData : MutableLiveData<Int> = MutableLiveData()
}
s
important note, it’s not an “immutable” version per se - it’s just exposed with a read-only interface
c
yeah i am used to only exposing read - only with the getter, but was looking at something like having my class that is mutated, but when giving the data it contains to other objects simply just create a new data class with values only over