List of usage examples for com.google.common.collect MinMaxPriorityQueue.Builder create
public static <E extends Comparable<E>> MinMaxPriorityQueue<E> create()
From source file:com.linkedin.pinot.core.query.aggregation.groupby.AggregationGroupByOperatorService.java
/** * Returns a MinMaxPriorityQueue with the given size limit, and ordering. * Will return null if the value to be inserted is not an instance of comparable. * * @param sampleObject To determine if the object is Comparable. * @param maxSize The max size for the heap. * @param reverseOrder True if sorting order to be reversed. * @return/* w w w .ja v a 2s . c om*/ */ private static MinMaxPriorityQueue<ImmutablePair<Serializable, String>> getMinMaxPriorityQueue( Serializable sampleObject, int maxSize, boolean reverseOrder) { if (!(sampleObject instanceof Comparable)) { return null; } Comparator<ImmutablePair<Serializable, String>> comparator = new GroupByResultComparator<ImmutablePair<Serializable, String>>() .newComparator(reverseOrder); MinMaxPriorityQueue.Builder<ImmutablePair<Serializable, String>> minMaxPriorityQueueBuilder = MinMaxPriorityQueue .orderedBy(comparator).maximumSize(maxSize); return minMaxPriorityQueueBuilder.create(); }