Java Reference
In-Depth Information
Chapters 13 and 14 give a full tutorial introduction to functional programming and how to write
functional-style programs in Java 8—including the toolkit of functions provided in its library.
Chapter 15 follows by discussing how Java 8 features compare to features in Scala—a language
that, like Java, is implemented on top of the JVM and that has evolved quickly to threaten some
aspects of Java's niche in the programming language ecosystem. This material is positioned
toward the end of the topic to provide additional insight into why the new Java 8 features were
added.
1.6. Summary
Following are the key concepts you should take away from this chapter:
Keep in mind the idea of language ecosystem and the consequent evolve-or-wither pressure on
languages. Although Java may be supremely healthy at the moment, you can recall other healthy
languages such as COBOL that failed to evolve.
The core additions to Java 8 provide exciting new concepts and functionality to ease the writing of
programs that are both effective and concise.
Multicore processors aren't fully served by existing Java programming practice.
Functions are first-class values; remember how methods can be passed as functional values and how
anonymous functions (lambdas) are written.
The Java 8 concept of Streams generalizes many aspects of Collections but both enables more
readable code and allows elements of a stream to be processed in parallel.
You can use a default method in an interface to provide a method body if an implementing class
chooses not to do so.
Other interesting ideas from functional programming include dealing with null and using pattern
matching.
 
Search WWH ::




Custom Search