Minimize references to java.util.Collections in stdlib sources

Only three usages are left in platform-independent code: in reverse, sort and
sortWith for mutable lists
This commit is contained in:
Alexander Udalov
2016-11-01 16:24:42 +03:00
parent b52f67132e
commit 30a7790dca
10 changed files with 12 additions and 30 deletions
@@ -11,8 +11,6 @@ package kotlin.collections
import kotlin.comparisons.*
import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/**
* Returns 1st *element* from the collection.
*/
@@ -796,7 +794,7 @@ public fun <T> MutableList<T>.reverse(): Unit {
public fun <T> Iterable<T>.reversed(): List<T> {
if (this is Collection && size <= 1) return toList()
val list = toMutableList()
Collections.reverse(list)
list.reverse()
return list
}