Skip to content

Commit

Permalink
Merge pull request #791 from er2/executeAroundLambda
Browse files Browse the repository at this point in the history
Execute Around - use lambda
  • Loading branch information
npathai committed Sep 8, 2018
2 parents 1698b06 + ec6d2a8 commit 9e56e5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
16 changes: 6 additions & 10 deletions execute-around/src/main/java/com/iluwatar/execute/around/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
package com.iluwatar.execute.around;

import java.io.FileWriter;
import java.io.IOException;

/**
Expand All @@ -42,14 +41,11 @@ public class App {
*/
public static void main(String[] args) throws IOException {

new SimpleFileWriter("testfile.txt", new FileWriterAction() {

@Override
public void writeFile(FileWriter writer) throws IOException {
writer.write("Hello");
writer.append(" ");
writer.append("there!");
}
});
FileWriterAction writeHello = writer -> {
writer.write("Hello");
writer.append(" ");
writer.append("there!");
};
new SimpleFileWriter("testfile.txt", writeHello);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* Interface for specifying what to do with the file resource.
*
*/
@FunctionalInterface
public interface FileWriterAction {

void writeFile(FileWriter writer) throws IOException;
Expand Down

0 comments on commit 9e56e5c

Please sign in to comment.