Notas
lambda Expression
Conteúdo das notas (7)
Página 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;
}
}
}
Página 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;
Página 3
Practical Example for Lambda implementation
l
Página 4
Example with Runnable interface.
Página 5
Lambda with Comparators:
Página 6
More on Functional interface:
Página 7
Informações
- Descrição
- Coding (Java 8) Notas sobre lambda Expression, criado por Naveen G em 20-11-2017.
- Criado por
- Naveen G
- Visualizações
- 0
- Avaliação