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/08/08 19:53:41 UTC

[commons-io] branch master updated: Use streams

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 a0d22baf Use streams
a0d22baf is described below

commit a0d22bafdfcd2eecfcc0ce39879e6808ef952035
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Aug 8 15:53:35 2022 -0400

    Use streams
---
 src/main/java/org/apache/commons/io/FileUtils.java | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index a456050a..66764263 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -3066,12 +3066,7 @@ public class FileUtils {
      * @throws NullPointerException if the parameter is null
      */
     private static String[] toSuffixes(final String... extensions) {
-        Objects.requireNonNull(extensions, "extensions");
-        final String[] suffixes = new String[extensions.length];
-        for (int i = 0; i < extensions.length; i++) {
-            suffixes[i] = "." + extensions[i];
-        }
-        return suffixes;
+        return Stream.of(Objects.requireNonNull(extensions, "extensions")).map(e -> "." + e).toArray(String[]::new);
     }
 
     /**