Lambda expression

Format

Argument List   Arrow Token   Body
(int x, int y)      ->        x + y

Example

public class RunnableTest {
  public static void main(String[] args) {

    // Anonymous Runnable
    Runnable r1 = new Runnable(){
      @Override
      public void run(){
        System.out.println("Hello world one!");
      }
    };

    // Lambda Runnable
    Runnable r2 = () -> System.out.println("Hello world two!");

    r1.run();
    r2.run();

   }
 }

ref

What Else?
inflearn react api server -50% 할인쿠폰: 15108-f2af1e086101 buy me a coffee