Java Reference
In-Depth Information
Chapter 1. Java 8: why should you care?
This chapter covers
Why Java is changing again
Changing computing background: multicore and processing large datasets (big data)
Pressure to evolve: new architectures favor functional style over imperative
Introducing core new features of Java 8: lambdas, streams, default methods
Since the release of JDK 1.0 (Java 1.0) in 1996, Java has won a large following of students,
project managers, and programmers who are active users. It's an expressive language and
continues to be used for projects both large and small. Its evolution (via the addition of new
features) from Java 1.1 (1997) to Java 7 (2011) has been well managed. Java 8 was released in
March 2014. So the question is this: why should you care about Java 8?
We argue that the changes to Java 8 are in many ways more profound than any other changes to
Java in its history. The good news is that the changes enable you to write programs more
easily—instead of writing verbose code like the following (to sort a list of apples in inventory
based on their weight),
Collections.sort(inventory, new Comparator<Apple>() {
public int compare(Apple a1, Apple a2){
return a1.getWeight().compareTo(a2.getWeight());
}
});
in Java 8 you can write more concise code that reads a lot closer to the problem statement:
It reads “sort inventory comparing apple weight.” Don't worry about this code for now. This
topic will explain what it does and how you can write similar code!
There's also a hardware influence: commodity CPUs have become multicore—the processor in
your laptop or desktop machine probably has four or more CPU cores within it. But the vast
majority of existing Java programs use only one of these cores and leave the other three idle (or
spend a small fraction of their processing power running part of the operating system or a virus
checker).
 
Search WWH ::




Custom Search