I'm trying to use maxBy in kotlin but I get a deprecated warning to replace it with maxByOrNull.
val max = response.maxBy { it.value.size }
maxBy((Map.Entry<K, V>) -> R): Map.Entry<K, V>?' is deprecated. Use maxByOrNull instead.
The autofix in android studio does it like below
val max = maxByOrNull({ it.value.size })
But this doesn't compile with error
Unresolved reference: maxByOrNull
What is the proper implementation as response.maxByOrNull { it.value.size }
also doesn't work