© Peter Späth and Jeff Friesen 2020
P. Späth, J. FriesenLearn Java for Android Developmenthttps://doi.org/10.1007/978-1-4842-5943-6_10

10. Functional Programming

Peter Späth1  and Jeff Friesen2
(1)
Leipzig, Sachsen, Germany
(2)
Winnipeg, MB, Canada
 

Functional programming is about promoting functions to first-class citizens in a computer language. This means apart from primitives and objects, reference-typed fields can also directly point to functions, and function arguments can be functions themselves. In addition, a language may also allow for special functional constructs like unnamed lambda calculus functions.

Consider, for example, the following code, which takes a list of strings and adds a “*” to all strings to create a new list:
List<String> l ...

Get Learn Java for Android Development: Migrating Java SE Programming Skills to Mobile Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.