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-exec.git
commit bbd78b8418b5a74a409978c9f6cf062f87608b40 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri Dec 29 13:19:02 2023 -0500 Use forEach() --- src/main/java/org/apache/commons/exec/Watchdog.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/exec/Watchdog.java b/src/main/java/org/apache/commons/exec/Watchdog.java index c278752a..f296cbca 100644 --- a/src/main/java/org/apache/commons/exec/Watchdog.java +++ b/src/main/java/org/apache/commons/exec/Watchdog.java @@ -18,7 +18,6 @@ package org.apache.commons.exec; import java.time.Duration; -import java.util.Enumeration; import java.util.Vector; /** @@ -66,10 +65,7 @@ public class Watchdog implements Runnable { } protected final void fireTimeoutOccured() { - final Enumeration<TimeoutObserver> e = observers.elements(); - while (e.hasMoreElements()) { - e.nextElement().timeoutOccured(this); - } + observers.forEach(o -> o.timeoutOccured(this)); } public void removeTimeoutObserver(final TimeoutObserver to) {