Skip to content

Commit 0732b44

Browse files
author
Gary Gregory
committed
Use removeIf() for a more efficient implementation which also deals with
the PMD empty while loop error.
1 parent 73d3281 commit 0732b44

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,7 @@ private File[] listFiles(final File file) {
444444
*/
445445
public void removeListener(final FileAlterationListener listener) {
446446
if (listener != null) {
447-
while (listeners.remove(listener)) {
448-
// empty
449-
}
447+
listeners.removeIf(listener::equals);
450448
}
451449
}
452450

0 commit comments

Comments
 (0)