acoconut
01/19/2022, 2:58 PMthanksforallthefish
01/19/2022, 3:04 PMclass SomeObj(val list: MutableList)
means someone could do
val obj = SomeObj(aList)
obj.list.add(newElem)
which seems “wrong” to me. maybe you could share some examples of this need and there might be different pattern you could apply (never really saw a builder in the sense of java builder in kotlin either, typically named parameters are quite sufficient there)Ruckus
01/19/2022, 3:51 PMclass SomeObj(val list: List)
the user can still do
Val list = mutableListOf(...)
val obj = SomeObj(list)
list.add(newElem)
thanksforallthefish
01/20/2022, 7:27 AMacoconut
01/24/2022, 9:57 AM