dsmiley commented on a change in pull request #1585:
URL: https://github.com/apache/lucene-solr/pull/1585#discussion_r441140226



##########
File path: lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
##########
@@ -399,6 +427,23 @@ public String segString(Directory dir) {
       }
       return b.toString();
     }
+
+    /**
+     * Waits if necessary for at most the given time for all merges.
+     */
+    boolean await(long timeout, TimeUnit unit) {
+      try {
+        CompletableFuture<Void> future = 
CompletableFuture.allOf(merges.stream()

Review comment:
       What I learned today: `CompletableFuture.allOf(....)` -- cool, thanks!  
So elegant.
   
   Let me try and return the favor:
   You can go directly to an array, avoiding toList:
   ```
   CompletableFuture<Void> future = CompletableFuture.allOf(merges.stream()
               .map(m -> m.completable).toArray(CompletableFuture<?>[]::new));
   ```
   BTW IntelliJ pointed this out and had an automatic replacement when I 
hovered my cursor over "collect".




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to