You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/01/30 21:17:00 UTC

[commons-io] branch master updated: Use java8 reference (#321)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new bcd5c9b  Use java8 reference (#321)
bcd5c9b is described below

commit bcd5c9ba0cd1607b286ef0c116f119983e3f8a15
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sun Jan 30 22:16:56 2022 +0100

    Use java8 reference (#321)
---
 src/main/java/org/apache/commons/io/FileUtils.java                    | 4 ++--
 .../java/org/apache/commons/io/output/FilterCollectionWriter.java     | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index 339a814..217e1e3 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -341,7 +341,7 @@ public class FileUtils {
      * @see #forceDelete(File)
      */
     public static void cleanDirectory(final File directory) throws IOException {
-        IOConsumer.forEach(listFiles(directory, null), file -> forceDelete(file));
+        IOConsumer.forEach(listFiles(directory, null), FileUtils::forceDelete);
     }
 
     /**
@@ -354,7 +354,7 @@ public class FileUtils {
      * @see #forceDeleteOnExit(File)
      */
     private static void cleanDirectoryOnExit(final File directory) throws IOException {
-        IOConsumer.forEach(listFiles(directory, null), file -> forceDeleteOnExit(file));
+        IOConsumer.forEach(listFiles(directory, null), FileUtils::forceDeleteOnExit);
     }
 
     /**
diff --git a/src/main/java/org/apache/commons/io/output/FilterCollectionWriter.java b/src/main/java/org/apache/commons/io/output/FilterCollectionWriter.java
index 08e7980..0473457 100644
--- a/src/main/java/org/apache/commons/io/output/FilterCollectionWriter.java
+++ b/src/main/java/org/apache/commons/io/output/FilterCollectionWriter.java
@@ -23,6 +23,7 @@ import java.io.Writer;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Objects;
 import java.util.function.Predicate;
 import java.util.stream.Stream;
 
@@ -47,7 +48,7 @@ import org.apache.commons.io.function.IOConsumer;
 public class FilterCollectionWriter extends Writer {
 
     @SuppressWarnings("rawtypes")
-    private static final Predicate NOT_NULL = e -> e != null;
+    private static final Predicate NOT_NULL = Objects::nonNull;
 
     @SuppressWarnings("unchecked")
     private static <T> Predicate<T> notNull() {