https://kotlinlang.org logo
#stdlib
Title
# stdlib
m

Marco Pierucci

03/06/2023, 4:24 AM
Whats the best way of converting of converting a List to an immutable list? If I do
driveActivities = drivingActivities.toImmutableList()
The compiler complains because
toImuutableList()
return a
List
I can use
driveActivities = drivingActivities.toPersistentList()
but it somehow feels like I'm leaking Impl details?
If I understood https://github.com/Kotlin/kotlinx.collections.immutable/issues/140 discussion correctly then using persitentList builder does not look like a bad idea
8 Views