> but it can still mess up the content right Ye...
# announcements
g
but it can still mess up the content right
Yes, if object in list is mutable there is no protection from modification. The only way: make object immutable or copy it before return:
Copy code
val myMutableList = mutableListOf<Foo>()
val list: List<Foo>
      get() = myMutableList.map { it.copy() } // Copy each item of Foo before return