SortedArrayList.cloneToList() is no longer susseptible to ConcurrentModificationException

This commit is contained in:
minjaesong
2022-01-23 20:25:20 +09:00
parent 162d211a2d
commit 250529e842
2 changed files with 1 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

View File

@@ -158,11 +158,7 @@ class SortedArrayList<T: Comparable<T>>(initialSize: Int = 10) : MutableCollecti
inline fun forEachIndexed(action: (Int, T) -> Unit) = arrayList.forEachIndexed(action)
fun cloneToList(): List<T> {
val ret = ArrayList<T>()
forEach {
ret.add(it)
}
return ret
return arrayList.toList()
}