added sample comparator code and tidied up some test cases & converted them to the cleaner JUnit 4 style
This commit is contained in:
@@ -53,7 +53,7 @@ inline fun <in T: java.lang.Comparable<T>> List<T>.sort() : List<T> {
|
||||
return this
|
||||
}
|
||||
|
||||
inline fun <in T: java.lang.Comparable<T>> List<T>.sort(comparator: java.util.Comparator<T>) : List<T> {
|
||||
inline fun <in T> List<T>.sort(comparator: java.util.Comparator<T>) : List<T> {
|
||||
Collections.sort(this, comparator)
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -58,9 +58,7 @@ private class FunctionComparator<T>(val functions: Array<Function1<T,Any?>>): C
|
||||
}
|
||||
|
||||
override fun compare(o1: T?, o2: T?): Int {
|
||||
// TODO compile error
|
||||
//return compareBy<T>(o1, o2, functions)
|
||||
throw UnsupportedOperationException("TODO")
|
||||
return compareBy<T>(o1, o2, *functions)
|
||||
}
|
||||
|
||||
override fun equals(obj: Any?): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user