// Пример 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"); };
Java Справочник v0.05 © 2007-2024 Igor Salnikov aka SunDoctor