Accept in-projection of Comparator as a parameter when possible.

This commit is contained in:
Ilya Gorbunov
2015-09-07 21:27:50 +03:00
parent 37d5a16a3d
commit 52f3e9ca06
5 changed files with 5 additions and 5 deletions
@@ -140,7 +140,7 @@ public fun ShortArray.asList(): List<Short> {
/**
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted according to the specified [comparator].
*/
public fun <T> Array<out T>.binarySearch(element: T, comparator: Comparator<T>, fromIndex: Int = 0, toIndex: Int = size()): Int {
public fun <T> Array<out T>.binarySearch(element: T, comparator: Comparator<in T>, fromIndex: Int = 0, toIndex: Int = size()): Int {
return Arrays.binarySearch(this, fromIndex, toIndex, element, comparator)
}