Лямбда выражения по-старому и по-новому


// Пример 1

Java 7:

button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
      System.out.println(“Action Detected”);
    }
  }
);

Java 8:

button.addActionListener(e -> {
        System.out.println(“Action Detected”);
    }
);


// Пример 2

Java 7:

Runnable runnable1 = new Runnable() {
@Override
public void run() {
        System.out.println("Running without Lambda");
    }
};

Java 8:

Runnable runnable2 = () -> { System.out.println("Running from Lambda"); };