August 2018
Beginner
178 pages
4h 56m
English
Kotlin supports naming arguments when passing them to functions. This can make your code more verbose but can improve its readability.
Java doesn't have named function arguments, and the common approach in Java is to use the builder pattern when your class or function accepts multiple arguments. This makes the code even more verbose. Consider this regionMatches function call on the String type; it accepts five arguments and three of them are of the Int type:
String str = "foo";boolean match = str.regionMatches(true, 0, "foo", 0, 3);
If you were reading this code for the first time, you'd probably have to look up this function documentation to see what all the arguments represent.
In Kotlin, thanks to named arguments, we can ...
Read now
Unlock full access