Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (19 sloc) 746 Bytes
package i_introduction._10_Object_Expressions
import util.TODO
import util.doc10
import java.util.*
fun todoTask10(): Nothing = TODO(
"""
Task 10.
Read about object expressions that play the same role in Kotlin as anonymous classes in Java.
Add an object expression that provides a comparator to sort a list in a descending order using 'java.util.Collections' class.
In Kotlin you use Kotlin library extensions instead of java.util.Collections,
but this example is still a good demonstration of mixing Kotlin and Java code.
""",
documentation = doc10()
)
fun task10(): List<Int> {
val arrayList = arrayListOf(1, 5, 2)
Collections.sort(arrayList, todoTask10())
return arrayList
}