Last active
August 7, 2018 13:03
-
-
Save drulabs/676b4f2243b1e9e88294101e6d04d586 to your computer and use it in GitHub Desktop.
Find customer with minimum balance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JAVA WAY - Who has minimum balance | |
Customer minBalanceCustomer = Collections.min( | |
customers, (o1, o2) -> (int) (o1.getBalance() - o2.getBalance()) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// KOTLIN WAY - Who has minimum balance | |
val minBalanceCustomer = customers.minBy { it.balance } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment