Aljoscha Burgmaier
02/09/2024, 1:15 PMswap and the and the toSynchonized from the Java utils. The swap I created smaller utilities to be able to swap an element within a MutableList and to retrieve a copy of a List with the swapped elements.
I had the idea to crate a PR to provide swap functionalities in Kotlin, what do you think?
I also discovered that you can swap elements within a normal List with the Collection utils. Is that a Bug?
import java.util.Collections
val list = listOf("A", "B", "C")
println(list) // [A, B, C]
Collections.swap(list, 0, 2)
println(list) // [C, B, A]Klitos Kyriacou
02/09/2024, 2:43 PMAljoscha Burgmaier
02/12/2024, 7:34 AMset. But I don't think that would work reliable.