mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 07:25:41 +00:00
docs: improve execute around
This commit is contained in:
@@ -30,7 +30,7 @@ import java.util.Scanner;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* The Execute Around idiom specifies executable code before and after a method. Typically
|
||||
* The Execute Around idiom specifies executable code before and after a method. Typically,
|
||||
* the idiom is used when the API has methods to be executed in pairs, such as resource
|
||||
* allocation/deallocation or lock acquisition/release.
|
||||
*
|
||||
@@ -47,9 +47,7 @@ public class App {
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
// create the file writer and execute the custom action
|
||||
FileWriterAction writeHello = writer -> {
|
||||
writer.write("Gandalf was here");
|
||||
};
|
||||
FileWriterAction writeHello = writer -> writer.write("Gandalf was here");
|
||||
new SimpleFileWriter("testfile.txt", writeHello);
|
||||
|
||||
// print the file contents
|
||||
|
||||
Reference in New Issue
Block a user