Improve your Java 9 programs using functional techniques.
Java 8 introduced a wealth of new features, pushing Java towards the so-called functional programming paradigm. Benefits from this shift include succinctness and ease in developing robust, multi-threaded applications. In this course, we introduce the key functional features of Java 8 and 9, and explain how they can be used to write code that is more expressive and amenable to parallelization. Specifically, we will first discuss lambda functions and functional interfaces. Using these features, programmers can easily create objects that offer a single specific service, similar to anonymous classes. We will also explore the predefined functional interfaces that can be found in the Java API, starting with well-known, pre-existing ones such as Comparator and Runnable. Reaping the full benefits of lambda functions requires employing them with streams, a new kind of collection with built-in parallelization support. We will examine the relationship between streams and collections, and how the latter have changed as a result of the new language features. Finally, after having mastered the key features of streams, we will explore the details of parallel execution, such as the crucial notion of side-effects and the fork-join execution model.
About the Author
Marco Faella is a professor of Computer Science at the University of Naples "Federico II", Italy. He has taught classes on Java programming, compiler construction, and software engineering to undergraduate and graduate students since 2005. He is the author of over 50 scientific publications in international conferences and journals. He has also developed scientific software in C++, OCaml, Python, and Java. Marco is fluent in C, C++, OCaml, Python, and Java and has contributed to the Parma Polyhedra Library, a well-known scientific library for the symbolic manipulation of polyhedra. He has extensive teaching experience in related topics, specifically a course on advanced Java programming with generics, collections, and multi-threading, which he has been teaching for the last 10 years (Linguaggi di Programmazione 2). He’s also writing 4 chapters of an upcoming book (in Italian) on Oracle OCP Java certification. Marco is fluent in C, C++, OCaml, Python, and Java and has contributed to the Parma Polyhedra Library, a well-known scientific library for symbolic manipulation of polyhedra. He has an extensive teaching experience in related topics, specifically a course on advanced Java programming with generics, collections, and multi-threading, which he has been teaching for the last 10 years (Linguaggi di Programmazione 2). He’s also writing 4 chapters of an upcoming book (in Italian) on Oracle OCP Java certification.