February 2014
Beginner
1248 pages
62h 25m
English
[This section demonstrates how lambdas and streams can be used to simplify programming tasks that you learned in Chapter 14, Strings, Characters and Regular Expressions.]
Figure 17.7 performs some of the same stream operations you learned in Sections 17.3–17.4 but on a Stream<String>. In addition, we demonstrate case-insensitive sorting and sorting in descending order. Throughout this example, we use the String array strings (lines 11–12) that’s initialized with color names—some with an initial uppercase letter. Line 15 displays the contents of strings before we perform any stream processing.
Read now
Unlock full access