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/21 15:07:46 UTC

[commons-lang] 05/10: Use Stream.

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-lang.git

commit ea2e58fc6883d64d7fe50fa883b068e153a28311
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 21 11:05:15 2022 -0400

    Use Stream.
---
 src/main/java/org/apache/commons/lang3/function/Failable.java | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/function/Failable.java b/src/main/java/org/apache/commons/lang3/function/Failable.java
index cdcfccce3..03db362ec 100644
--- a/src/main/java/org/apache/commons/lang3/function/Failable.java
+++ b/src/main/java/org/apache/commons/lang3/function/Failable.java
@@ -32,6 +32,7 @@ import java.util.function.Predicate;
 import java.util.function.Supplier;
 import java.util.stream.Stream;
 
+import org.apache.commons.lang3.stream.Streams;
 import org.apache.commons.lang3.stream.Streams.FailableStream;
 
 /**
@@ -522,11 +523,7 @@ public class Failable {
         } else {
             actualErrorHandler = errorHandler;
         }
-        if (resources != null) {
-            for (final FailableRunnable<? extends Throwable> failableRunnable : resources) {
-                Objects.requireNonNull(failableRunnable, "runnable");
-            }
-        }
+        Streams.of(resources).forEach(r -> Objects.requireNonNull(r, "runnable"));
         Throwable th = null;
         try {
             action.run();