Comparator<T> replaced with Comparator<in T> #KT-6030 Fixed

This commit is contained in:
Ilya Ryzhenkov
2014-11-05 18:18:16 +03:00
parent 24ee79aa2d
commit c2fabf5736
3 changed files with 5 additions and 5 deletions
@@ -4,10 +4,10 @@ import java.lang.*
import java.util.* import java.util.*
library("collectionsMax") library("collectionsMax")
public fun max<T>(col : Collection<T>, comp : Comparator<T>) : T = noImpl public fun max<T>(col : Collection<T>, comp : Comparator<in T>) : T = noImpl
library("collectionsSort") library("collectionsSort")
public fun <T> sort(list: MutableList<T>): Unit = noImpl public fun <T> sort(list: MutableList<T>): Unit = noImpl
library("collectionsSort") library("collectionsSort")
public fun <T> sort(list: MutableList<T>, comparator: java.util.Comparator<T>): Unit = noImpl public fun <T> sort(list: MutableList<T>, comparator: java.util.Comparator<in T>): Unit = noImpl
+2 -2
View File
@@ -116,7 +116,7 @@ public fun <T : Comparable<T>> Iterable<T>.sort(): List<T> {
/** /**
* Returns a list of all elements, sorted by the specified *comparator* * Returns a list of all elements, sorted by the specified *comparator*
*/ */
public fun <T> Array<out T>.sortBy(comparator: Comparator<T>): List<T> { public fun <T> Array<out T>.sortBy(comparator: Comparator<in T>): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
java.util.Collections.sort(sortedList, comparator) java.util.Collections.sort(sortedList, comparator)
return sortedList return sortedList
@@ -125,7 +125,7 @@ public fun <T> Array<out T>.sortBy(comparator: Comparator<T>): List<T> {
/** /**
* Returns a list of all elements, sorted by the specified *comparator* * Returns a list of all elements, sorted by the specified *comparator*
*/ */
public fun <T> Iterable<T>.sortBy(comparator: Comparator<T>): List<T> { public fun <T> Iterable<T>.sortBy(comparator: Comparator<in T>): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
java.util.Collections.sort(sortedList, comparator) java.util.Collections.sort(sortedList, comparator)
return sortedList return sortedList
@@ -161,7 +161,7 @@ fun ordering(): List<GenericFunction> {
exclude(Strings) exclude(Strings)
} }
templates add f("sortBy(comparator: Comparator<T>)") { templates add f("sortBy(comparator: Comparator<in T>)") {
doc { doc {
""" """
Returns a list of all elements, sorted by the specified *comparator* Returns a list of all elements, sorted by the specified *comparator*