merlimat commented on a change in pull request #3732: [pulsar-broker] Optimize 
message replay for large backlog consumer
URL: https://github.com/apache/pulsar/pull/3732#discussion_r261814779
 
 

 ##########
 File path: 
pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongPairSet.java
 ##########
 @@ -190,11 +187,16 @@ public int removeIf(LongPairPredicate filter) {
      * @return a new list of keys with max provided numberOfItems (makes a 
copy)
      */
     public Set<LongPair> items(int numberOfItems) {
-        Set<LongPair> items = new HashSet<>();
+        return items(numberOfItems, (item1, item2) -> new LongPair(item1, 
item2));
+    }
+
+    @Override
+    public <T> Set<T> items(int numberOfItems, BiFunction<Long, Long, T> 
longPairConverter) {
+        Set<T> items = new HashSet<>();
 
 Review comment:
   Is it necessary to return a set? typically the iteration methods are used to 
go through it inline without intermediary collection.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to