Reading notes, "Java8 combat" The first chapter, why should care about JAVA8

Source: Internet
Author: User

   the author suggests that Java8 's changes are far more profound in many ways than any other change in Java history. And the good news is that these changes will make it easier for you to edit the program, and no longer have to write verbose code similar to the event handlers in previous Swing. With regard to multithreading, the author also mentions that from the evolutionary path of java, he has been working to make concurrent programming easier and less ERROR-PRONE. For example, the concept of thread and lock in Java1.0, which was the best practice of the time, proved that it was difficult to reliably use these basic models without the expertise of the project Team. Then in Java 5.0, you add Industrial-grade building blocks such as thread pools and concurrent Collections. Then to Java7, the branch merge (fork/join) framework was added, making parallelism more practical, but still difficult. so, when it comes to Java8, there's a much simpler new way of thinking about parallelism, but you still have to follow some rules. in the first section, why is Java still changing? Java has done well in the world of programming languages, but the climate of the programming language ecosystem is changing, and programmers increasingly need to deal with so-called big data, and want to use multicore computers and computer clusters for efficient processing, which means that Java has not previously supported this in terms of parallel processing.    So Java8 's main benefit to programmers is that it provides more programming tools and concepts that can be faster and more important to solve new or existing programming problems in a more concise and maintainable manner.    next, The author introduces the new concept of stream processing in java8, which uses streaming commands in unix-loaded systems as an Example. The 3rd section of the author introduces parameterization of BehaviorThe Concept.    is to pass the code or function as a parameter to another method. The author then mentions the functional programming paradigm Two cornerstonesfirst, There is no shared mutable data, second, the ability to pass methods and functions to other methodssection ii, functions in JavaThe practice of the jvm-based languages such as Scala and groovy has shown that the concept of a method can be used as a tool library to augment programmers, making programming easier.    here, The author gives a simple example to illustrate the advantages of functional programming by implementing a hidden file filtering example before and after the Java8 Code. It then gives an example of the benefits of lambda and stream by selecting apples from a bunch of apples, different colors, or different weights. And then this leads to the FLOW. Internal iterations(this is relative to the traditional external Iteration) concept.here, The author mentions the difference between a set and a stream, primarily to store and access the data, and the flow is primarily used to describe the calculation of the data . section fourth, default methodIn the beginning, the author mentions that the default method in Java8 is primarily to support the library designer, allowing them to write interfaces that are easier to Improve.    The author uses the list interface to add sorting methods to illustrate the benefits of this default Method. of course, in fact, I think that the concept of the default method of Java8, the interface may be made nondescript, because in this case the interface contains business logic, which is actually equivalent to C + + abstract class. How to avoid the infamous multiple inheritance diamond inheritance problem in C + +? It is said that in the Nineth chapter of the talk, then we will wait and see!
From for Notes (Wiz)

Reading notes, "Java8 combat" The first chapter, why should care about JAVA8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.