is there ever a reason to use mutable list vs list in spring boot:?
e
Esa
10/13/2020, 7:19 AM
In some instances you may need it to populate a list
t
Tobias Berger
10/13/2020, 7:43 AM
I dnn't know what that has to do with spring boot. If you need a mutable collection in your code, use one.
Things that are good to know though:
• List and MutableList created by functions like
listOf
and
mutableListOf
are the same actual type in most cases (except empty lists). They mostly just use standard ArrayList.
• The differend generics bounds can unexpectedly mess up some Platform calls or apt/kapt-based code generation. So remember: the direct equivalent of a Java List is a Kotlin MutableList.
n
nathan
10/14/2020, 12:15 AM
right now im using List in my entity for one to Many
nathan
10/14/2020, 12:15 AM
so im wondering does it matter if its Mutable or not