Size: 1.3 GB
Java 8: Lambda Expressions and Streams covers the most important new features introduced in Java 8. It is presented by Marty Hall, bestselling author, world-renowned instructor, and president of the training company coreservlets.com. This LiveLesson explains the syntax and usage of Java 8 lambda expressions, shows the prebuilt functions, covers streams thoroughly, and gives examples of the types of applications to which lambdas and streams are well suited
Skill Level: Intermediate to advanced
3+ Hours of Video Instruction
Java 8: Lambda Expressions and Streams covers the most important new features introduced in Java 8. It is presented by Marty Hall, bestselling author, world-renowned instructor, and president of the training company coreservlets.com. This LiveLesson explains the syntax and usage of Java 8 lambda expressions, shows the prebuilt functions, covers streams thoroughly, and gives examples of the types of applications to which lambdas and streams are well suited.
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.
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.
Technologies that support lambdas: method references, lambda building blocks in the java.util.function package, effectively-final local variables, the @FunctionalInterface annotation, and higher-order functions.
Stream methods: forEach, map, filter, reduce, etc.
Infinite (unbounded) streams
Lazy evaluation and short-circuit stream operations.
Supporting Java 8 features: interfaces with concrete methods and the Optional class.
This LiveLesson assumes that you have moderate to strong Java experience. It covers only the new features of the language that are added in Java 8. However, no previous experience with functional programming is required.
Lesson 1 gets you started by explaining how to obtain and install Java 8, where to find documentation, and how to set up the major IDEs to use Java 8. It also has a quick review of two topics from the standard Java programming that we build on later: anonymous inner classes and defining classes and methods that use generic types.
Lesson 2 gives the motivation for lambda expressions and shows the various syntactical alternatives for representing lambdas. Along the way, it compares the lambda approach to pre-Java 8 approaches and to approaches from other languages. This lesson also introduces four supporting topics that are new to Java 8—effectively final local variables, the @FunctionalInterface annotation, method references, and the java.util.function package.
Lesson 3 looks in more detail at the java.util.function package and shows how the interfaces there can be used as building blocks for lambdas. In particular, it explains the five most important elements of this package—Predicate, Function, Consumer, Supplier, and BinaryOperator. For each of these, it explains the syntax, but more importantly shows you how applying them can make your code shorter, simpler, easier to maintain, and more easily reused.
Lesson 4 shows the power of higher order functions: methods that return lambdas. The Lesson looks at both builtin and custom methods that do this. This lesson also gives more detail on the method references that were introduced earlier, and explains some of the tricky cases. It also discusses some of the new features of Java 8 interfaces, namely that Java 8 interfaces can have concrete method implementations, called default methods, as well as static methods.
Lesson 5 moves on to streams. It gives an overview of streams and contrasts streams with collections, shows how to build streams, and explains how to output streams into standard data structures like arrays or lists. It also covers the core stream methods, forEach, map, filter, and findFirst. This lesson also explains the lazy evaluation features of streams, so that streams are not only simpler and more powerful than standard collections, but often also have significantly higher performance.
Lesson 6 covers the remaining stream methods, most importantly the reduce operation. It also shows how stream operations can automatically be processed concurrently without requiring any explicit multithreading code. This lesson concludes with an advanced topic—infinite streams—that have no fixed number of entries, but rather create the values on the fly as they are needed.
The LiveLessons Video Training series publishes hundreds of hands-on, expert-led video tutorials covering a wide selection of technology topics designed to teach you the skills you need to succeed. This professional and personal technology video series features world-leading author instructors published by your trusted technology brands: Addison-Wesley, Cisco Press, IBM Press, Pearson IT Certification, Prentice Hall, Sams, and Que. Topics include: IT Certification, Programming, Web Development, Mobile Development, Home and Office Technologies, Business and Management, and more. View all LiveLessons on InformIT at http://www.informit.com/livelessons