gsmiller commented on code in PR #15823:
URL: https://github.com/apache/lucene/pull/15823#discussion_r2960834947


##########
lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java:
##########
@@ -174,6 +179,32 @@ public void addAll(Collection<T> elements) {
     }
   }
 
+  /**
+   * Similar to {@link #addAll(Collection)}, but supply an {@link 
ElementSupplier} to convert origin
+   * element to target element. This is useful when source elements does not 
fit target elements.
+   */
+  public <S> void addAll(Collection<S> elements, ElementSupplier<T, S> 
elementSupplier) {

Review Comment:
   Can you add test coverage for this method?



##########
lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java:
##########
@@ -174,6 +179,32 @@ public void addAll(Collection<T> elements) {
     }
   }
 
+  /**
+   * Similar to {@link #addAll(Collection)}, but supply an {@link 
ElementSupplier} to convert origin

Review Comment:
   Maybe we could be more explicit in the documentation that the value of this 
version of addAll is for cases where you need to convert between element types 
since it doesn't require the caller to do the conversion at the call site? 



##########
lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java:
##########
@@ -174,6 +179,32 @@ public void addAll(Collection<T> elements) {
     }
   }
 
+  /**
+   * Similar to {@link #addAll(Collection)}, but supply an {@link 
ElementSupplier} to convert origin
+   * element to target element. This is useful when source elements does not 
fit target elements.
+   */
+  public <S> void addAll(Collection<S> elements, ElementSupplier<T, S> 
elementSupplier) {

Review Comment:
   What if we just use `Function<S, T>` as the type of `elementSupplier` here 
so we don't need another interface definition?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to