Refactor: Get updating pendingDevices out of the loop

Change-Id: I1b1c5ac141a68a6d6308238ae0934249c7a3af96
diff --git a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
index 04d8385..ae0b153 100644
--- a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
@@ -629,9 +629,9 @@
             for (FlowRuleOperation flowRuleOperation : ops) {
                 FlowRuleBatchEntry fbe =
                         new FlowRuleBatchEntry(mapOperationType(flowRuleOperation.type()), flowRuleOperation.rule());
-                pendingDevices.add(flowRuleOperation.rule().deviceId());
                 perDeviceBatches.put(flowRuleOperation.rule().deviceId(), fbe);
             }
+            pendingDevices.addAll(perDeviceBatches.keySet());
 
             for (DeviceId deviceId : perDeviceBatches.keySet()) {
                 long id = idGenerator.getNewId();