Java 8 Combat (note) Chapter I

Source: Internet
Author: User

A stream is a series of data items that generate only one item at a time.

Java 8 new Programming Concepts: Stream processing, passing code through APIs, functional programming.

:: Syntax: "Use this method as a value".

Functional Programming Style: write the function as an equivalent program.

predicate (predicate): The predicate accepts a parameter value and returns TRUE or false. Predicate<t> is a more standard way to avoid enclosing a Boolean in a Boolean.

Collection, For-each, processing data-external iterations, Steam API data processing is done entirely inside the library-internal iterations.

Collection is primarily intended to store and access data, while stream is primarily used to describe the calculation of data.

The Optional<t> class is a container object that can contain or does not contain a value. There are methods to deal with situations where the value does not exist, thus avoiding nullpointerexception.

Use the default method in an excuse to provide the method content when the implementation class has no implementation method.

The stream concept enables many aspects of collections to be popularized, making code easier to read, and allowing parallel streaming of elements.

(structure) pattern matching: functions are defined in terms of conditions, not if-then-else.

Functional languages tend to allow switch to be used on more data types, including allow pattern matching.

Java 8 Combat (note) Chapter I

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.