GoConqr has a new look! Let us know what you think.

Notes

lambda Expression

Naveen G Coding English 7 pages

lambda Expression

Content of the notes (7)

Page 1

What is lambda expression for?

Example:

only one method in this interface

public interface FileFilter(){

pblic boolean filter(File file);

}

Ways to use this interface:

By implementing this interface

public class File implements FileFilter{

@override

public void boolean filter(){

return true;

}

}

File f=new File();

f.filter(f);

2. By making anonymous class

public class File{

FileFilter f=new FileFilter(){

@override

public boolean filter(){

return true;

}

}

}

Page 2

To make instance of anonymous inner class easier to write and read.

Another way to write instances for anonymous java inner class.

FileFilter f=(File file) -> true;

lambda Expression

lambda Expression

lambda Expression

Page 3

Practical Example for Lambda implementation

l

lambda Expression

Page 4

Example with Runnable interface.

lambda Expression

lambda Expression

Page 5

Lambda with Comparators:

lambda Expression

Page 6

More on Functional interface:

lambda Expression

lambda Expression

lambda Expression

Page 7

lambda Expression

Information

Description
Coding (Java 8) Note on lambda Expression, created by Naveen G on 20/11/2017.
Created by
Naveen G
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?