Notizen
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;
Seite 3
Practical Example for Lambda implementation
l
Seite 4
Example with Runnable interface.
Seite 5
Lambda with Comparators:
Seite 6
More on Functional interface:
Seite 7
Informationen
- Beschreibung
- Coding (Java 8) Notiz am lambda Expression, erstellt von Naveen G am 20/11/2017.
- Erstellt von
- Naveen G
- Aufrufe
- 0
- Bewertung