how can i use generic constraints? (<https://kotli...
# announcements
j
how can i use generic constraints? (https://kotlinlang.org/docs/reference/generics.html#generic-constraints) trying to compile the example at the bottom
Copy code
fun <T> cloneWhenGreater(list: List<T>, threshold: T): List<T>
        where T : Comparable<T>,
T : Cloneable {
    return list.filter { it > threshold }.map { it.clone() }
}
fails because of
required List<T>
but found
List<Any>