There is a little part of uncompilable code on Kotlin.Reference.Generics (at the end of topic):
fun <T> cloneWhenGreater(list: List<T>, threshold: T): List<T>
where T : Comparable,
T : Cloneable {
return list.filter { it > threshold }.map { it.clone() }
}
Firstly, there is a Comparable<<>T> and not Comparable (without generics).
Secondly, Cloneable.clone() is a protected one, so we can’t use it in such a way.
I understand that this section is about generics and this is a good example, but it would be better to have a really working code there.