Issue
I have a defined a set like below.
val resultSet: Set<Pair<Driver,Int>>
How to get maximum value of above resultSet set with its key?
Solution
You can use the maxBy function. It returns the maximum value given by the extractor you pass to it, or null if the set is empty. You could do something like this:
val maxPair = resultSet.maxBy { it.second }
Answered By - marstran
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.