Complete the code to declare a generic function with a constraint using the where clause.
fun <T> checkValue(value: T) where T : [1] {
println(value)
}The generic type T is constrained to Number using the where clause, so only types that inherit from Number are allowed.
Complete the code to declare a generic function with two constraints using the where clause.
fun <T> process(item: T) where T : Comparable<T>, T : [1] {
println(item)
}The generic type T is constrained to both Comparable<T> and Number, so it must be a numeric type that can be compared.
Fix the error in the generic function declaration by completing the where clause correctly.
fun <T> compareValues(a: T, b: T) where T : [1], T : Comparable<T> { println(if (a > b) a else b) }
The function requires T to be a Number and also implement Comparable<T> to use the comparison operator.
Fill both blanks to declare a generic function with constraints that T must be a Number and implement Comparable.
fun <T> maxValue(a: T, b: T) where T : [1], T : [2] { println(if (a > b) a else b) }
The generic type T must be a Number and implement Comparable<T> to allow comparison.
Fill all three blanks to declare a generic function with constraints that T must be a Number, implement Comparable, and also implement CharSequence.
fun <T> complexCheck(item: T) where T : [1], T : [2], T : [3] { println(item) }
The generic type T must be a Number, implement Comparable<T>, and also implement CharSequence to satisfy all constraints.