GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Notizen

lambda Expression

Naveen G Coding Englisch 7 Seiten

lambda Expression

Inhalt der Notizen (7)

Seite 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;

}

}

}

Seite 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

Seite 3

Practical Example for Lambda implementation

l

lambda Expression

Seite 4

Example with Runnable interface.

lambda Expression

lambda Expression

Seite 5

Lambda with Comparators:

lambda Expression

Seite 6

More on Functional interface:

lambda Expression

lambda Expression

lambda Expression

Seite 7

lambda Expression

Informationen

Beschreibung
Coding (Java 8) Notiz am lambda Expression, erstellt von Naveen G am 20/11/2017.
Erstellt von
Naveen G
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck