Sho SHIMIZU
Committed by Gerrit Code Review

Stop using explicit Optional#get()

Change-Id: Ifd14b02fad398d9a84c95328fcd0e8367d63cf33
......@@ -205,9 +205,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
// 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()
......
......@@ -21,7 +21,6 @@ import static org.slf4j.LoggerFactory.getLogger;
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 class PartitionManager extends AbstractListenerManager<PartitionEvent, Pa
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());
}
}
......