File tree 2 files changed +7
-10
lines changed
execute-around/src/main/java/com/iluwatar/execute/around
2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 22
22
*/
23
23
package com .iluwatar .execute .around ;
24
24
25
- import java .io .FileWriter ;
26
25
import java .io .IOException ;
27
26
28
27
/**
@@ -42,14 +41,11 @@ public class App {
42
41
*/
43
42
public static void main (String [] args ) throws IOException {
44
43
45
- new SimpleFileWriter ("testfile.txt" , new FileWriterAction () {
46
-
47
- @ Override
48
- public void writeFile (FileWriter writer ) throws IOException {
49
- writer .write ("Hello" );
50
- writer .append (" " );
51
- writer .append ("there!" );
52
- }
53
- });
44
+ FileWriterAction writeHello = writer -> {
45
+ writer .write ("Hello" );
46
+ writer .append (" " );
47
+ writer .append ("there!" );
48
+ };
49
+ new SimpleFileWriter ("testfile.txt" , writeHello );
54
50
}
55
51
}
Original file line number Diff line number Diff line change 30
30
* Interface for specifying what to do with the file resource.
31
31
*
32
32
*/
33
+ @ FunctionalInterface
33
34
public interface FileWriterAction {
34
35
35
36
void writeFile (FileWriter writer ) throws IOException ;
You can’t perform that action at this time.
0 commit comments