Cleanup ordering, improve API
This commit is contained in:
@@ -80,8 +80,7 @@ fun ordering(): List<GenericFunction> {
|
||||
body {
|
||||
"""
|
||||
val sortedList = toArrayList()
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> y.compareTo(x) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
java.util.Collections.sort(sortedList, comparator { x, y -> y.compareTo(x) })
|
||||
return sortedList
|
||||
"""
|
||||
}
|
||||
@@ -105,7 +104,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> = compareBy(order)
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
return sortedList
|
||||
"""
|
||||
@@ -128,7 +127,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> = compareBy(order)
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
return sortedList
|
||||
"""
|
||||
@@ -150,7 +149,7 @@ fun ordering(): List<GenericFunction> {
|
||||
body {
|
||||
"""
|
||||
val sortedList = toArrayList()
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> order(y).compareTo(order(x)) }
|
||||
val sortBy: Comparator<T> = compareByDescending(order)
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
return sortedList
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user