Make Comparator fun interface in Common and JS

This commit is contained in:
Ilya Gorbunov
2020-06-02 00:24:01 +03:00
parent 388e619d90
commit d2ea108123
5 changed files with 24 additions and 47 deletions
+3 -7
View File
@@ -1,16 +1,12 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin
public actual interface Comparator<T> {
public actual fun interface Comparator<T> {
@JsName("compare")
actual fun compare(a: T, b: T): Int
}
public actual inline fun <T> Comparator(crossinline comparison: (a: T, b: T) -> Int): Comparator<T> = object : Comparator<T> {
override fun compare(a: T, b: T): Int = comparison(a, b)
public actual fun compare(a: T, b: T): Int
}