Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec6d2a8

Browse files
committed
execute around lambda
1 parent038befe commitec6d2a8

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

‎execute-around/src/main/java/com/iluwatar/execute/around/App.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*/
2323
packagecom.iluwatar.execute.around;
2424

25-
importjava.io.FileWriter;
2625
importjava.io.IOException;
2726

2827
/**
@@ -42,14 +41,11 @@ public class App {
4241
*/
4342
publicstaticvoidmain(String[]args)throwsIOException {
4443

45-
newSimpleFileWriter("testfile.txt",newFileWriterAction() {
46-
47-
@Override
48-
publicvoidwriteFile(FileWriterwriter)throwsIOException {
49-
writer.write("Hello");
50-
writer.append(" ");
51-
writer.append("there!");
52-
}
53-
});
44+
FileWriterActionwriteHello =writer -> {
45+
writer.write("Hello");
46+
writer.append(" ");
47+
writer.append("there!");
48+
};
49+
newSimpleFileWriter("testfile.txt",writeHello);
5450
}
5551
}

‎execute-around/src/main/java/com/iluwatar/execute/around/FileWriterAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* Interface for specifying what to do with the file resource.
3131
*
3232
*/
33+
@FunctionalInterface
3334
publicinterfaceFileWriterAction {
3435

3536
voidwriteFile(FileWriterwriter)throwsIOException;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp