+ @FunctionalInterface
+ public static interface FileOperation {
+ IOperation<Boolean, IOException> perform(File file);
+
+ default void perform(File... files) {
+ for (File f : files)
+ perform(f);
+ }
+ }
+
+ public static class DeleteOperation implements FileOperation {
+ private final FileService service;
+ private final DeleteOption[] options;
+
+ public DeleteOperation(FileService service, DeleteOption... options) {
+ this.service = service;
+ this.options = options;
+ }
+
+ @Override
+ public IOperation<Boolean, IOException> perform(File file) {
+ return service.scheduleDeleteIfExists(file, options);
+ }
+ }
+