Java Reference
In-Depth Information
Figure 1.1. Programming languages ecosystem and climate change
The main benefit of Java 8 to a programmer is that it provides more programming tools and
concepts to solve new or existing programming problems more quickly or, more importantly, in
a more concise, more easily maintainable way. Although the concepts are new to Java, they've
proved powerful in niche research-like languages. We highlight and develop the ideas behind
three such programming concepts that have driven the development of the Java 8 features to
exploit parallelism and write more concise code in general. We introduce them in a slightly
different order from the rest of the topic to enable a Unix-based analogy and to expose the “need
this because of that ” dependencies in Java 8's new parallelism for multicore.
1.1.2. Stream processing
The first programming concept is stream processing . For introductory purposes, a stream is a
sequence of data items that are conceptually produced one at a time—a program might read
items from an input stream one by one and similarly write items to an output stream. The
output stream of one program could well be the input stream of another.
One practical example is in Unix or Linux, where many programs operate by reading data from
standard input ( stdin in Unix and C, System.in in Java), operating on it, and then writing their
results to standard output ( stdout in Unix and C, System.out in Java). First, a little background:
Unix cat creates a stream by concatenating two files, tr translates the characters in a stream, sort
sorts lines in a stream, and tail -3 gives the last three lines in a stream. The Unix command line
allows such programs to be linked together with pipes (|), giving examples such as
 
Search WWH ::




Custom Search