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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user