Kotlin Map methods – minBy() minWith()

kotlin-map-methods-minby-minwith-feature-image

In the tutorial, JavaSampleApproach will show how to use Kotlin Map methods minBy(), minWith().

I. Kotlin Map methods – minBy() minWith()

1. minBy()

minBy() returns the first entry having smallest value of the given function selector: (Map.Entry) -> R or ‘null’ if there are no elements.
Method signature:

Practice:

2. minWith()

minWith() returns the first entry having the smallest value according to the provided [comparator]
Method signature:

Practice:

II. Full Sourcecode



By grokonez | January 12, 2018.

Last updated on September 6, 2018.



Related Posts


Got Something To Say:

Your email address will not be published. Required fields are marked *

*