February 2014
Intermediate to advanced
160 pages
4h 59m
English
Make everything as simple as possible, but not simpler.
The JDK has evolved to include convenience methods that promote the functional style. When using familiar classes and interfaces from the library—String, for example—we need to look for opportunities to use these newer functions in place of the old style. Also, anywhere we used an anonymous inner class with just one method, we can now use lambda expressions to reduce clutter and ceremony.
In this chapter we’ll use lambda expressions and method references to iterate over a String, to implement Comparators, to list files in a directory, and to observe file and directory changes. Quite a few methods introduced in the previous chapter ...