Move Comparator to kotlin.comparisons and make it imported by default.
#KT-2084
This commit is contained in:
@@ -43,6 +43,7 @@ abstract class TargetPlatform(val platformName: String) {
|
||||
add(ImportPath("kotlin.ranges.*"))
|
||||
add(ImportPath("kotlin.sequences.*"))
|
||||
add(ImportPath("kotlin.text.*"))
|
||||
add(ImportPath("kotlin.comparisons.Comparator"))
|
||||
}
|
||||
|
||||
override val platformConfigurator =
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kotlin.comparisons
|
||||
|
||||
|
||||
public interface Comparator<T> {
|
||||
@JsName("compare") fun compare(a: T, b: T): Int
|
||||
}
|
||||
|
||||
public inline fun <T> Comparator(crossinline comparison: (T, T) -> Int): Comparator<T> = object : Comparator<T> {
|
||||
override fun compare(a: T, b: T): Int = comparison(a, b)
|
||||
}
|
||||
@@ -16,14 +16,6 @@
|
||||
|
||||
package java.util
|
||||
|
||||
interface Comparator<T> {
|
||||
@JsName("compare") fun compare(a: T, b: T): Int
|
||||
}
|
||||
|
||||
inline fun <T> Comparator(crossinline comparison: (T, T) -> Int): Comparator<T> = object : Comparator<T> {
|
||||
override fun compare(a: T, b: T): Int = comparison(a, b)
|
||||
}
|
||||
|
||||
|
||||
// TODO: Not supported
|
||||
// typealias Date = kotlin.js.Date
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
@file:kotlin.jvm.JvmVersion
|
||||
|
||||
package kotlin.comparisons
|
||||
|
||||
public typealias Comparator<T> = java.util.Comparator<T>
|
||||
Reference in New Issue
Block a user