Can I use the lambda everytime I would pass an object that implements an interface?
Like the example below:
JButton button = new JButton();
// Without Lambda
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Doing something.");
}
});
// With Lambda
button.addActionListener(e -> {
System.out.println("Doing something.");
});
RE: [Programming][Java][Guide] Using Lambda Expressions In Java [Part 1]