Github user anew commented on a diff in the pull request:
https://github.com/apache/incubator-tephra/pull/62#discussion_r140172443
--- Diff:
tephra-hbase-compat-1.1-base/src/main/java/org/apache/tephra/hbase/txprune/InvalidListPruningDebugTool.java
---
@@ -204,16 +204,19 @@ public int compare(RegionPruneInfo o1,
RegionPruneInfo o2) {
return Long.compare(o1.getPruneUpperBound(),
o2.getPruneUpperBound());
}
};
- Queue<RegionPruneInfoPretty> lowestPrunes =
+ MinMaxPriorityQueue<RegionPruneInfoPretty> lowestPrunes =
MinMaxPriorityQueue.orderedBy(comparator).maximumSize(numRegions).create();
for (RegionPruneInfo pruneInfo : regionPruneInfos) {
lowestPrunes.add(new RegionPruneInfoPretty(pruneInfo));
}
- TreeSet<RegionPruneInfoPretty> regionSet = new TreeSet<>(comparator);
- regionSet.addAll(lowestPrunes);
- return regionSet;
+ List<RegionPruneInfoPretty> regions = new ArrayList<>(numRegions);
+ RegionPruneInfoPretty e;
+ while ((e = lowestPrunes.pollFirst()) != null) {
--- End diff --
isn't that the same as addAll?
---