Package org.apache.druid.collections
Class StableLimitingSorter<T>
- java.lang.Object
-
- org.apache.druid.collections.StableLimitingSorter<T>
-
public class StableLimitingSorter<T> extends Object
Simultaneously sorts and limits its input. The sort is stable, meaning that equal elements (as determined by the comparator) will not be reordered. Not thread-safe. Note: this class doesn't have its own unit tests. It is tested along withTopNSequence
in "TopNSequenceTest".
-
-
Constructor Summary
Constructors Constructor Description StableLimitingSorter(Comparator<T> comparator, int limit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T element)
Offer an element to the sorter.Iterator<T>
drain()
Drain elements in sorted order (least first).int
size()
Returns the number of elements currently in the sorter.
-
-
-
Constructor Detail
-
StableLimitingSorter
public StableLimitingSorter(Comparator<T> comparator, int limit)
-
-