guava/src/com/google/common/collect/MinMaxPriorityQueue.java
public static Builder<Comparable> maximumSize(int maximumSize) {
    return new Builder<Comparable>(Ordering.natural()).maximumSize(maximumSize);
  }
public static Builder<Comparable> maximumSize(int maximumSize) {
    return new Builder<Comparable>(Ordering.natural()).maximumSize(maximumSize);
  }
Creates and returns a new builder, configured to build {@code MinMaxPriorityQueue} instances
that are limited to {@code maximumSize} elements. Each time a queue grows beyond this bound, it
immediately removes its greatest element (according to its comparator), which might be the
element that was just added.