CompletableFuture<Void> () { if (myAllTodos == null) { return CompletableFuture.completedFuture(null); } ReadConstraint inSmartMode = ReadConstraint.Companion.inSmartMode(myProject); CompletableFuture<?>[] futures = myPanels.stream() .map(TodoPanel::getTreeBuilder) .map(TodoTreeBuilder::getCoroutineHelper) .map(helper -> helper.scheduleCacheAndTreeUpdate(inSmartMode)) .toArray(CompletableFuture[]::new); return CompletableFuture.allOf(futures); }