forked from iluwatar/java-design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a Lambdas example for the callback pattern, using the same ou…
…tput of the traditional version. Have also added another unit test for issue iluwatar#334
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
callback/src/main/java/com/iluwatar/callback/LambdasApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters