You have written a function, sort(), that should accept only collections that implement the Comparable interface. How can you restrict the function?
fun sort(list: List<T>): List <T> {
return list.sorted()
}
You have written a function, sort(), that should accept only collections that implement the Comparable interface. How can you restrict the function?
fun sort(list: List<T>): List <T> {
return list.sorted()
}