filmov
tv
Lambda Building Blocks in java.util.function Overview

Показать описание
Lambda expressions are a way of representing "functions", and Java 8 introduces a number of prebuilt function building blocks as well as a set of function composition methods. Although lambda expressions are not quite real functions, they are close enough for most purposes, and have very succinct syntax that looks like anonymous functions from Scala (minus the type declarations) and are even moderately similar to JavaScript anonymous functions.
Streams are wrappers around arrays, collections, or other data sources that use lambdas pervasively. They support many convenient and high-performance operations that use lambdas, including "map", "reduce", "filter", and "forEach". They also support lazy evaluation, so if you map firstName over a Stream of Employees, filter the ones that start with "P", then choose the first, it really only maps and filters until the first match. Streams can also be made parallel automatically, so that the operations are done in parallel without having to write any explicit multithreading code.
Lambdas don't exactly turn Java into Lisp, and streams don't exactly turn Java SE into Hadoop. Nevertheless, they provide significant new capabilities to Java, and taken together, lambdas and streams result in by far the biggest change in Java programming style since at least 2004, when generics and annotations were added to the language.
Skill Level: Intermediate to advanced
Who Should Take This Course?: Experienced Java developers who need to learn about the new features introduced in Java SE 8
What You Will Learn:
• How to use the most important features of Java 8: lambda expressions and streams.
• Stream methods: forEach, map, filter, reduce, etc.
• Infinite (unbounded) streams
• Parallel streams.
• Lazy evaluation and short-circuit stream operations.
• Supporting Java 8 features: interfaces with concrete methods and the Optional class.
Комментарии