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/07/09 11:56:55 UTC

[commons-bcel] branch master updated: Use forEach()

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


The following commit(s) were added to refs/heads/master by this push:
     new cbbed9ec Use forEach()
cbbed9ec is described below

commit cbbed9ec41c70469cab42a584e205b96c0f964fc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 9 07:56:50 2022 -0400

    Use forEach()
---
 src/main/java/org/apache/bcel/util/ModularRuntimeImage.java | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/bcel/util/ModularRuntimeImage.java b/src/main/java/org/apache/bcel/util/ModularRuntimeImage.java
index f362865b..6081ab80 100644
--- a/src/main/java/org/apache/bcel/util/ModularRuntimeImage.java
+++ b/src/main/java/org/apache/bcel/util/ModularRuntimeImage.java
@@ -31,7 +31,6 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -103,10 +102,7 @@ public class ModularRuntimeImage implements Closeable {
     public List<Path> list(final Path dirPath) throws IOException {
         final List<Path> list = new ArrayList<>();
         try (DirectoryStream<Path> ds = Files.newDirectoryStream(dirPath)) {
-            final Iterator<Path> iterator = ds.iterator();
-            while (iterator.hasNext()) {
-                list.add(iterator.next());
-            }
+            ds.forEach(list::add);
         }
         return list;
     }