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_r261814760
##########
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) {
Review comment:
If we use some kind a specialized interface we can avoid 2 `long` -> `Long`
conversions:
```java
interface LongPairFunction<T> {
T apply(long a, long b);
}
----------------------------------------------------------------
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