August 2017
Intermediate to advanced
440 pages
10h
English
Collection processing is one of the most common tasks in programming. This is why one of the first things that developers learn is how to iterate over a collection to operate on elements. Young developers asked to print all users from a list will most probably use a for loop:
for (user in users) {
println(user)
}
If we asked them to show only the users that are passing in school, then they would most probably add an if condition inside this loop:
for (user in users) {
if ( user.passing ) {
println(user)
}
}
This is still a correct implementation, but the real problem starts when the task becomes more complex. What if they were asked to print the three best students that are passing? It is really complex to implement ...
Read now
Unlock full access