I am requesting your opinion. I can have a class like for example
class MyClass<T>(val myList: List<T>)
If I want to make myList modifiable I could take two approaches:
- Make myList a MutableList and then I can add or remove from the list
- Make myList a var property and then just reassign a new object when needed
Which approach do you consider better and why (for example less error-prone)?
Or there is not truly a best solution and it depends on the use case?
Thanks for your attention