0% found this document useful (0 votes)
1 views1 page

Java 8 Notes Part 1

Part 1 of the document covers key features introduced in Java 8, including Lambda Expressions, Functional Interfaces, and the Stream API. Lambda expressions allow for a concise representation of anonymous functions, while functional interfaces are defined as having exactly one abstract method. An example of a functional interface, 'Calculator', is provided to illustrate its use with a lambda expression for addition.

Uploaded by

seema
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views1 page

Java 8 Notes Part 1

Part 1 of the document covers key features introduced in Java 8, including Lambda Expressions, Functional Interfaces, and the Stream API. Lambda expressions allow for a concise representation of anonymous functions, while functional interfaces are defined as having exactly one abstract method. An example of a functional interface, 'Calculator', is provided to illustrate its use with a lambda expression for addition.

Uploaded by

seema
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Part 1 - Java 8 Introduction, Lambda Expressions & Functional Interfaces

Introduction
Java 8 introduced Lambda Expressions, Functional Interfaces, Stream API, Method
References, Optional, Date & Time API, Default Methods, Parallel Streams and
CompletableFuture.

Lambda Expressions
Lambda expressions provide a concise way to represent anonymous functions.

Runnable r = () -> [Link]("Hello");


(x) -> x * x
(a,b) -> a + b

Functional Interfaces
A functional interface contains exactly one abstract method.

@FunctionalInterface
interface Calculator {
int add(int a,int b);
}
Calculator c = (a,b) -> a+b;

You might also like