October 2019
Intermediate to advanced
434 pages
11h 54m
English
Functional programming languages rely on pure transformations of data to perform work. This approach differs from Object-Oriented Programming rather significantly because functional programming avoids mutable data and a global state.
With Kotlin's support for first-class functions and its large Standard library, it's possible to use it to write highly functional programs as well. The following snippet is a small example of how functional code can be written in Kotlin by chaining multiple function calls together and processing data without side-effects:
// Performing multiple filter operations on an input liststudentList .filter { student -> student.grade == 11 } .filter { student -> student.gpa > 3.5 }
Read now
Unlock full access