Avoid using negative in descending sorts.

This commit is contained in:
Ilya Ryzhenkov
2014-11-05 17:41:29 +03:00
parent 55590e00a5
commit 0dc68c2702
2 changed files with 5 additions and 5 deletions
@@ -80,7 +80,7 @@ fun ordering(): List<GenericFunction> {
body {
"""
val sortedList = toArrayList()
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -x.compareTo(y) }
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> y.compareTo(x) }
java.util.Collections.sort(sortedList, sortBy)
return sortedList
"""
@@ -150,7 +150,7 @@ fun ordering(): List<GenericFunction> {
body {
"""
val sortedList = toArrayList()
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -order(x).compareTo(order(y)) }
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> order(y).compareTo(order(x)) }
java.util.Collections.sort(sortedList, sortBy)
return sortedList
"""