Fix sonar complains
[bgpcep.git] / pcep / topology-provider / src / main / java / org / opendaylight / bgpcep / pcep / topology / provider / TopologyNodeState.java
index 09bab98c5738f2536d522b1664cccd22ea455b72..122f3dd5beb9138037c53003c4675a174252b346 100644 (file)
@@ -73,12 +73,7 @@ final class TopologyNodeState implements AutoCloseable, TransactionChainListener
     }
 
     public synchronized void cleanupExcept(final Collection<String> values) {
-        final Iterator<String> it = this.metadata.keySet().iterator();
-        while (it.hasNext()) {
-            if (!values.contains(it.next())) {
-                it.remove();
-            }
-        }
+        this.metadata.keySet().removeIf(s -> !values.contains(s));
     }
 
     public synchronized void released(final boolean persist) {