Refactor: Consolidate multiple map() invocations to single invocation
Change-Id: I53bd6a80f34469eb23874f91dd52a895e0f5a2dc
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
index 71c8764..f1d895b 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
@@ -325,15 +325,15 @@
(we can also try to update these individually)
*/
List<CompletableFuture<IntentData>> futures = operations.stream()
- .map(CompletableFuture::completedFuture)
- .map(x -> x.thenApply(IntentManager.this::createInitialPhase))
- .map(x -> x.thenApplyAsync(IntentManager.this::process, workerExecutor))
- .map(x -> x.thenApply(FinalIntentProcessPhase::data))
- .map(x -> x.exceptionally(e -> {
- //FIXME
- log.warn("Future failed: {}", e);
- return null;
- }))
+ .map(x -> CompletableFuture.completedFuture(x)
+ .thenApply(IntentManager.this::createInitialPhase)
+ .thenApplyAsync(IntentManager.this::process, workerExecutor)
+ .thenApply(FinalIntentProcessPhase::data)
+ .exceptionally(e -> {
+ //FIXME
+ log.warn("Future failed: {}", e);
+ return null;
+ }))
.collect(Collectors.toList());
store.batchWrite(Tools.allOf(futures).join().stream()
.filter(Objects::nonNull)