File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
execute-around/src/main/java/com/iluwatar/execute/around Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 2222 */
2323package com .iluwatar .execute .around ;
2424
25- import java .io .FileWriter ;
2625import java .io .IOException ;
2726
2827/**
@@ -42,14 +41,11 @@ public class App {
4241 */
4342 public static void main (String [] args ) throws IOException {
4443
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 );
5450 }
5551}
Original file line number Diff line number Diff line change 3030 * Interface for specifying what to do with the file resource.
3131 *
3232 */
33+ @ FunctionalInterface
3334public interface FileWriterAction {
3435
3536 void writeFile (FileWriter writer ) throws IOException ;
You can’t perform that action at this time.
0 commit comments