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:
@@ -38,7 +38,6 @@ fun List<GenericFunction>.writeTo(file: File, builder: GenericFunction.() -> Str
|
||||
its.append("package kotlin.collections\n\n")
|
||||
its.append("$COMMON_AUTOGENERATED_WARNING\n\n")
|
||||
its.append("import java.util.*\n\n")
|
||||
its.append("import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js\n\n")
|
||||
for (t in this.sortedBy { it.signature }) {
|
||||
its.append(t.builder())
|
||||
}
|
||||
@@ -59,7 +58,6 @@ fun List<ConcreteFunction>.writeTo(outDir: File, sourceFile: SourceFile) {
|
||||
its.append("$COMMON_AUTOGENERATED_WARNING\n\n")
|
||||
its.append("import kotlin.comparisons.*\n")
|
||||
its.append("import java.util.*\n\n")
|
||||
its.append("import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js\n\n")
|
||||
|
||||
for (f in this) {
|
||||
f.textBuilder(its)
|
||||
|
||||
@@ -33,7 +33,7 @@ fun ordering(): List<GenericFunction> {
|
||||
"""
|
||||
if (this is Collection && size <= 1) return toList()
|
||||
val list = toMutableList()
|
||||
Collections.reverse(list)
|
||||
list.reverse()
|
||||
return list
|
||||
"""
|
||||
}
|
||||
@@ -42,7 +42,7 @@ fun ordering(): List<GenericFunction> {
|
||||
"""
|
||||
if (isEmpty()) return emptyList()
|
||||
val list = toMutableList()
|
||||
Collections.reverse(list)
|
||||
list.reverse()
|
||||
return list
|
||||
"""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user