val myDict : HashMap<Int, String> = hashMapOf( 0 to "zero", 1 to "one", 2 to "two" )
I have to find maximum Int key value of myDict HashMap. something like this:
myDict.getMaxKey() // should be 2
Advertisement
Answer
You could do this :
myDict.keys.maxOrNull()
Api reference : keys
, maxOrNull()