Sho SHIMIZU

Use JDK's Optional instead of Guava's Optional

Change-Id: Ia37b2977ede215363374e292b5565f007f1d6483
......@@ -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 @@ public final class ReplicaInfo {
* @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 @@ public final class ReplicaInfo {
// for Serializer
private ReplicaInfo() {
this.master = Optional.absent();
this.master = Optional.empty();
this.backups = Collections.emptyList();
}
}
......
......@@ -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 org.onosproject.store.flow.ReplicaInfoService;
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 @@ public class ReplicaInfoManagerTest {
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());
}
......@@ -116,7 +116,7 @@ public class ReplicaInfoManagerTest {
MasterNodeCheck(CountDownLatch latch, DeviceId did,
NodeId nid) {
this.latch = latch;
this.expectedMaster = Optional.fromNullable(nid);
this.expectedMaster = Optional.ofNullable(nid);
this.expectedDevice = did;
}
......