Created a Lambdas example for the callback pattern, using the same output of the traditional version. Have also added another unit test for issue #334
This commit is contained in:
19
callback/src/main/java/com/iluwatar/callback/LambdasApp.java
Normal file
19
callback/src/main/java/com/iluwatar/callback/LambdasApp.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.iluwatar.callback;
|
||||
|
||||
/**
|
||||
*
|
||||
* This example generates the exact same output as {@link App} however the callback has been
|
||||
* defined as a Lambdas expression.
|
||||
*
|
||||
*/
|
||||
public class LambdasApp {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
Task task = new SimpleTask();
|
||||
Callback c = () -> System.out.println("I'm done now.");
|
||||
task.executeWith(c);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user