Use JDK's Optional instead of Guava's Optional
Change-Id: Ia37b2977ede215363374e292b5565f007f1d6483
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/ReplicaInfo.java b/core/store/dist/src/main/java/org/onosproject/store/flow/ReplicaInfo.java
index 1d07c39..13f4295 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/ReplicaInfo.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/ReplicaInfo.java
@@ -15,15 +15,14 @@
*/
package org.onosproject.store.flow;
-import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.base.Objects;
+import org.onosproject.cluster.NodeId;
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
-import org.onosproject.cluster.NodeId;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Class to represent placement information about Master/Backup copy.
@@ -40,7 +39,7 @@
* @param backups list of NodeId, where backup copies should be placed
*/
public ReplicaInfo(NodeId master, List<NodeId> backups) {
- this.master = Optional.fromNullable(master);
+ this.master = Optional.ofNullable(master);
this.backups = checkNotNull(backups);
}
@@ -79,7 +78,7 @@
// for Serializer
private ReplicaInfo() {
- this.master = Optional.absent();
+ this.master = Optional.empty();
this.backups = Collections.emptyList();
}
}
diff --git a/core/store/dist/src/test/java/org/onosproject/store/flow/impl/ReplicaInfoManagerTest.java b/core/store/dist/src/test/java/org/onosproject/store/flow/impl/ReplicaInfoManagerTest.java
index 445a907..265dbd0 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/flow/impl/ReplicaInfoManagerTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/flow/impl/ReplicaInfoManagerTest.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.store.flow.impl;
-import com.google.common.base.Optional;
import com.google.common.collect.Maps;
import org.junit.After;
import org.junit.Before;
@@ -38,6 +37,7 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.Map;
+import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -89,7 +89,7 @@
assertEquals(Collections.emptyList(), info1.backups());
ReplicaInfo info2 = service.getReplicaInfoFor(DID2);
- assertEquals("There's no master", Optional.absent(), info2.master());
+ assertEquals("There's no master", Optional.empty(), info2.master());
// backups are always empty for now
assertEquals(Collections.emptyList(), info2.backups());
}
@@ -114,9 +114,9 @@
MasterNodeCheck(CountDownLatch latch, DeviceId did,
- NodeId nid) {
+ NodeId nid) {
this.latch = latch;
- this.expectedMaster = Optional.fromNullable(nid);
+ this.expectedMaster = Optional.ofNullable(nid);
this.expectedDevice = did;
}