Deprecate 'comparator { ... }' in favor of Comparator SAM-constructor. Provide SAM-like constructor for JS.

This commit is contained in:
Ilya Gorbunov
2016-01-17 17:26:38 +03:00
parent 67ef790abc
commit 5bbce7a1de
5 changed files with 9 additions and 20 deletions
+4
View File
@@ -11,6 +11,10 @@ public interface Comparator<T> {
public fun compare(obj1: T, obj2: T): Int;
}
public inline fun <T> Comparator(crossinline comparison: (T, T) -> Int): Comparator<T> = object : Comparator<T> {
override fun compare(obj1: T, obj2: T): Int = comparison(obj1, obj2)
}
@library
public abstract class AbstractCollection<E>() : MutableCollection<E> {
override fun isEmpty(): Boolean = noImpl