What's New in Java 8: Lambdas
4.3 (76 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1,455 students enrolled
Wishlisted Wishlist

Please confirm that you want to add What's New in Java 8: Lambdas to your Wishlist.

Add to Wishlist

What's New in Java 8: Lambdas

An in-depth look at the new features of Java 8
4.3 (76 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1,455 students enrolled
Created by Toby Weston
Last updated 6/2014
English
Current price: $49 Original price: $50 Discount: 2% off
30-Day Money-Back Guarantee
Includes:
  • 1.5 hours on-demand video
  • 2 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • A FREE companion eBook to support your study
  • Get an overview of (almost) all of the new features in Java 8
  • Gain in-depth understanding of the major new features in Java 8 that you can apply straight away
View Curriculum
Requirements
  • Previous experience with Java (pre Java-8)
  • An IDE to practice and experiment with the examples
  • Java Software Development Kit (SDK) available FREE from Oracle
Description

This is PART 1 of a two part course looking at the new features of Java 8.

In this part, we take an in-depth look at lambdas and their supporting features; things like functional interfaces and type inference. In the follow up course (PART 2), we look at the remaining features.

After watching this course, you'll

  • Have an overview of new features in Java 8
  • Understand lambdas in-depth, their background, syntax, implementation details and how and when to use them
  • Understand the difference between functions to classes and why that's relevant to lambdas
  • Understand the difference between lambdas and closures
  • Appreciate the improvements to type inference that drive a lot of the new features
  • Be able to use method references and understand scoping and "effectively final"
  • Understand the differences in bytecode produced when using lambdas
  • Be able to reason about exceptions and exception handling best practice when using lambdasvariables

So whether you're migrating existing Java programs to Java 8 or building applications from scratch, this course will help you start to leverage the power of functional programming on the Java platform.

Who is the target audience?
  • Anyone interested in learning about Java 8
  • Prior knowledge and experience of pre Java-8 is advantagous
Curriculum For This Course
19 Lectures
02:06:42
+
Introduction
3 Lectures 05:30

Welcome to the course.

Preview 01:14

A whistle-stop tour of the new features.

00:00 Introduction

00:42 Run down of the new features

What's New in Java 8
03:43

The course comes with a free companion eBook.

Please register your course at http://bit.ly/whatsnewjava8 for updates to the book and to be notified of special offers on related courses.

00:00 Download your FREE companion eBook

00:15 Register for updates

Registration
00:33
+
Introduction to Lambdas
5 Lectures 07:38

A quick summary of what we'll be covering in this section.

Preview 00:15

This lecture talks about some background to functional programming and lambdas in general.

00:00 Background

00:15 Alonzo Church and the lambda calculus

01:00 John McCarthy and LISP

01:30 Lambda calculus and LISP expressions side by side

01:55 What is a lambda?

λs in Functional Programming
02:12

Anonymous functions (aka lambdas) are not the same thing as anonymous classes in Java.

Although we might start to use them in a similar way, there are several technical differences. Find out about these before we look at Java 8's syntax.

00:00 Lambdas aren't the same as anonymous classes

00:34 Summary

01:15 Lambdas aren't just syntactic sugar

Functions vs Classes
01:23

Discover the basic syntax of lambdas in Java. We look at variations on the new syntax and how to put together a lambda.

Get up and running quickly and see how to convert legacy code to using the new syntax.

00:00 Introduction and Comparator example

01:15 Converting anonymous classes to lambdas

02:40 Syntax summary

Preview 03:37

Review
00:11

Test your knowledge on Lambdas.

Lambda Quiz
7 questions
+
Lambdas In-depth
10 Lectures 01:06:34

A quick summary of what we'll be covering in this section.

Preview 00:26

In this lecture, we talk about functional interfaces.

Functional interfaces are just regular Java interfaces but with just one method. Because Java understands the options for using these are limited (they only have one method), it can do all kinds of neat things. The most significant of which is using lambdas in-lieu of anonymous implementations of the interface.

00:00 What is a functional interface? SAM?

00:50 Examples of using the functional interface annotation

04:00 Summary

Functional Interfaces
05:14

Recap the basics of type inference and learn about Java 8's improvements. We cover "target" typing as well as looking at the Java Enhancement Proposal (JEP) 101 covering generalised target typing.

00:00 Introducing the changes due to type inference with Java 8

00:22 Recapping the basics of type inference

01:45 Type erasure

02:52 The three areas of improvement

03:10 Target typing for lambdas

04:45 Parameter type inference in method calls

06:00 Parameter type inference for chained methods

Preview 06:34

Find out how to pass around references to exsitings methods using method references.

We take a look at the variations on syntax and show how you might use each.

00:00 What is a method reference?

01:08 What can you do with them?

03:35 The four types of method reference

04:03 Constructor method references (includes constructor arguments)

09:25 Static method references

10:00 Instance method references (of a particular object)

10:50 Instance method references (of an arbitrary object)

11:47 Summary of syntax

Method & Constructor References
12:32

Lambdas are lexically scoped in Java 8. In this lecture, find out more about scoping and the new effectively final concept.

00:00 Scoping introduction

00:34 Lexical scoping demo

02:34 Effectively final introduction

03:15 Effectively final demo

07:35 Warning! Be more functional. Use fold/reduce instead!

Scope & Effectively Final
08:08

Let's take a look at the options with dealing with exception from lambdas. We'll look at it from the perspective of the developer writing lambdas and from the perspective of the library developer, calling lambdas passed in.

00:00 Introducing the issues

02:12 Exception handling from the author's perspective

08:09 Exception handling from the client's perspective

11:35 Side by side comparison

Exception Handling
11:55

The term closures and lambdas are often used interchangeably but just as often incorrectly. There are key differences between the two and in this lecture we'll take a look at what they are.

00:00 Introduction and Java timeline

01:25 What's the difference?

05:09 Side by side comparison

06:05 Summary

Lambdas vs Closures
07:17

Take a look at the differences in bytecode between anonymous classes and the new lambdas.

00:00 Introduction

00:30 Recap on bytecode basics

01:55 Java as a stack based computation model

03:50 JVM "descriptors" ie, Ljava/lang/String;

05:57 Introducing the examples

06:20 Anonymous class

07:50 Anonymous class closing over variables (closure)

08:29 Lambda with no arguments

10:46 Lambda with arguments

12:20 Lambda closing over variables (closure)

13:04 Summary

Invocation & Bytecode (invokedynamic vs invokestatic)
14:17

The source and corresponding bytecode for the examples from the previous lecture.

Preview 20 pages

Review
00:11

Now really test your understanding of lambdas in Java.

Lambdas In-depth Quiz
13 questions
+
Java 7 Recap
1 Lecture 00:00
About the Instructor
Toby Weston
4.3 Average rating
76 Reviews
1,455 Students
1 Course
Independent Software Developer

I specialise in modern software development; functional and object-oriented programming, agile and lean best practice. I wrote the book Essential Acceptance Testing and have written for magazines as well as regularly blogging.

I've been part of the software industry for more than fifteen years and love what I do. I love talking and writing about it and sharing my experiences online with Udemy.