Package com.google.common.collect
Class MinMaxPriorityQueue.Builder<B>
- java.lang.Object
-
- com.google.common.collect.MinMaxPriorityQueue.Builder<B>
-
- Type Parameters:
B
- the upper bound on the eventual type that can be produced by this builder (for example, aBuilder<Number>
can produce aQueue<Number>
orQueue<Integer>
but not aQueue<Object>
).
- Enclosing class:
- MinMaxPriorityQueue<E>
public static final class MinMaxPriorityQueue.Builder<B> extends java.lang.Object
The builder class used in creation of min-max priority queues. Instead of constructing one directly, useMinMaxPriorityQueue.orderedBy(Comparator)
,MinMaxPriorityQueue.expectedSize(int)
orMinMaxPriorityQueue.maximumSize(int)
.- Since:
- 8.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends B>
MinMaxPriorityQueue<T>create()
Builds a new min-max priority queue using the previously specified options, and having no initial contents.<T extends B>
MinMaxPriorityQueue<T>create(java.lang.Iterable<? extends T> initialContents)
Builds a new min-max priority queue using the previously specified options, and having the given initial elements.MinMaxPriorityQueue.Builder<B>
expectedSize(int expectedSize)
Configures this builder to build min-max priority queues with an initial expected size ofexpectedSize
.MinMaxPriorityQueue.Builder<B>
maximumSize(int maximumSize)
Configures this builder to buildMinMaxPriorityQueue
instances that are limited tomaximumSize
elements.
-
-
-
Method Detail
-
expectedSize
@CanIgnoreReturnValue public MinMaxPriorityQueue.Builder<B> expectedSize(int expectedSize)
Configures this builder to build min-max priority queues with an initial expected size ofexpectedSize
.
-
maximumSize
@CanIgnoreReturnValue public MinMaxPriorityQueue.Builder<B> maximumSize(int maximumSize)
Configures this builder to buildMinMaxPriorityQueue
instances that are limited tomaximumSize
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.
-
create
public <T extends B> MinMaxPriorityQueue<T> create()
Builds a new min-max priority queue using the previously specified options, and having no initial contents.
-
create
public <T extends B> MinMaxPriorityQueue<T> create(java.lang.Iterable<? extends T> initialContents)
Builds a new min-max priority queue using the previously specified options, and having the given initial elements.
-
-