commit | 5fab6e5071f04e9fe0d885aa3e5af0c2959355b2 | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Mon Feb 15 11:54:15 2016 -0800 |
committer | Gerrit Code Review <gerrit@onlab.us> | Wed Feb 17 01:22:04 2016 +0000 |
tree | d70a97c5c5ff213a3c7434ef755fe21f0a633a21 | |
parent | f08cb4c0e025087222d1f80a1fd99eb1e00b6115 [diff] |
Stop using explicit Optional#get() Change-Id: Ifd14b02fad398d9a84c95328fcd0e8367d63cf33
diff --git a/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java index 16bbad3..00ccd9d 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java +++ b/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java
@@ -205,9 +205,7 @@ // Extract Discrete instances from resources List<Resource> resources = ids.stream() .filter(x -> x.parent().isPresent()) - .map(x -> lookup(childTxMap, x)) - .filter(Optional::isPresent) - .map(Optional::get) + .flatMap(x -> Tools.stream(lookup(childTxMap, x))) .collect(Collectors.toList()); // the order is preserved by LinkedHashMap Map<DiscreteResourceId, List<Resource>> resourceMap = resources.stream()
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/PartitionManager.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/PartitionManager.java index 76709d6..3826116 100644 --- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/PartitionManager.java +++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/PartitionManager.java
@@ -21,7 +21,6 @@ import java.io.File; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -150,9 +149,7 @@ public List<PartitionInfo> partitionInfo() { return partitions.values() .stream() - .map(StoragePartition::info) - .filter(Optional::isPresent) - .map(Optional::get) + .flatMap(x -> Tools.stream(x.info())) .collect(Collectors.toList()); } }