Use Optional instead of null to remove FIXME comment

Change-Id: I21c0cd954eaff4441392205aede95b34285f1402
diff --git a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleBatchEntry.java b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleBatchEntry.java
index a82d60e..b814a98 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleBatchEntry.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleBatchEntry.java
@@ -17,23 +17,25 @@
 
 import org.onosproject.net.flow.FlowRuleBatchEntry.FlowRuleOperation;
 
+import java.util.Optional;
+
 
 public class FlowRuleBatchEntry
         extends BatchOperationEntry<FlowRuleOperation, FlowRule> {
 
-    private final Long id; // FIXME: consider using Optional<Long>
+    private final Optional<Long> id;
 
     public FlowRuleBatchEntry(FlowRuleOperation operator, FlowRule target) {
         super(operator, target);
-        this.id = null;
+        this.id = Optional.empty();
     }
 
-    public FlowRuleBatchEntry(FlowRuleOperation operator, FlowRule target, Long id) {
+    public FlowRuleBatchEntry(FlowRuleOperation operator, FlowRule target, long id) {
         super(operator, target);
-        this.id = id;
+        this.id = Optional.of(id);
     }
 
-    public Long id() {
+    public Optional<Long> id() {
         return id;
     }
 
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowRuleProvider.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowRuleProvider.java
index 65c980d..513dd0c 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowRuleProvider.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowRuleProvider.java
@@ -385,7 +385,7 @@
 
         private final Set<FlowEntry> offendingFlowMods = Sets.newHashSet();
         // Failed batch operation id
-        private Long failedId;
+        private Optional<Long> failedId;
 
         private final CountDownLatch countDownLatch;
         private BatchState state;
@@ -509,7 +509,7 @@
         public CompletedBatchOperation get() throws InterruptedException, ExecutionException {
             countDownLatch.await();
             this.state = BatchState.FINISHED;
-            Set<Long> failedIds = (failedId != null) ?  Sets.newHashSet(failedId) : Collections.emptySet();
+            Set<Long> failedIds = (failedId.isPresent()) ?  Sets.newHashSet(failedId.get()) : Collections.emptySet();
             CompletedBatchOperation result =
                     new CompletedBatchOperation(ok.get(), offendingFlowMods, failedIds);
             //FIXME do cleanup here (moved by BOC)
@@ -523,7 +523,7 @@
                 TimeoutException {
             if (countDownLatch.await(timeout, unit)) {
                 this.state = BatchState.FINISHED;
-                Set<Long> failedIds = (failedId != null) ?  Sets.newHashSet(failedId) : Collections.emptySet();
+                Set<Long> failedIds = (failedId.isPresent()) ? Sets.newHashSet(failedId.get()) : Collections.emptySet();
                 CompletedBatchOperation result =
                         new CompletedBatchOperation(ok.get(), offendingFlowMods, failedIds);
                 // FIXME do cleanup here (moved by BOC)