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/06/14 22:38:15 UTC

[commons-io] 01/02: Use removeIf() for a more efficient implementation which also deals with the PMD empty while loop error.

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

commit 73d32811ce6b6d6fc84a5d62071058db60b7f7dd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 14 18:37:28 2022 -0400

    Use removeIf() for a more efficient implementation which also deals with
    the PMD empty while loop error.
---
 .../java/org/apache/commons/io/monitor/FileAlterationMonitor.java     | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java b/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java
index df539aa9..9a4b81b0 100644
--- a/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java
+++ b/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java
@@ -129,9 +129,7 @@ public final class FileAlterationMonitor implements Runnable {
      */
     public void removeObserver(final FileAlterationObserver observer) {
         if (observer != null) {
-            while (observers.remove(observer)) {
-                // empty
-            }
+            observers.removeIf(observer::equals);
         }
     }