Simplify code using Java 8 features
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / entityownership / EntityOwnershipShardCommitCoordinator.java
index 4e344cd68825f006b2bd944eb9661fd7affd3f67..f3adfbd51e373a0f9c8a515040123f71e735a448 100644 (file)
@@ -222,13 +222,7 @@ class EntityOwnershipShardCommitCoordinator {
             }
 
             // Prune the subsequent pending modifications.
-            Iterator<Modification> iter = pendingModifications.iterator();
-            while (iter.hasNext()) {
-                Modification mod = iter.next();
-                if (!canForwardModificationToNewLeader(mod)) {
-                    iter.remove();
-                }
-            }
+            pendingModifications.removeIf(mod -> !canForwardModificationToNewLeader(mod));
         }
     }