hey really rookie question. If i have a mutable map = {3=0, 4=0, 5=0, 6=0, 7=1, 8=1, 9=1, 10=1, 11=2} . If I'm trying to get the max value in this --map.maxBy{it.value} . It returns a value 11=2. What type is this and how do I get the value "2" from it? -> https://leetcode.com/playground/eQrqK2Ug
✅ 1
w
wbertan
03/19/2021, 3:15 PM
Hey @Varun, it would be of type
Map.Entry<Int, Int>
You can access by the properties
key
and `value`:
Copy code
println(maxi.key) // 11
println(maxi.value) // 2
v
Varun
03/19/2021, 3:32 PM
Hey @wbertan thanks! I swear i tried that 10 times... but somehow works now :S
Varun
03/19/2021, 3:32 PM
Line 5: Char 17: error: unresolved reference: value println(maxi.value)