diff --git a/jdk/src/share/classes/java/util/PriorityQueue.java b/jdk/src/share/classes/java/util/PriorityQueue.java index c28647b58bb..c5a961cdbe9 100644 --- a/jdk/src/share/classes/java/util/PriorityQueue.java +++ b/jdk/src/share/classes/java/util/PriorityQueue.java @@ -135,6 +135,19 @@ public class PriorityQueue extends AbstractQueue this(initialCapacity, null); } + /** + * Creates a {@code PriorityQueue} with the default initial capacity + * that orders its elements according to the specified comparator. + * + * @param comparator the comparator that will be used to order this + * priority queue. If {@code null}, the {@linkplain Comparable + * natural ordering} of the elements will be used. + * @since 1.8 + */ + public PriorityQueue(Comparator comparator) { + this(DEFAULT_INITIAL_CAPACITY, comparator); + } + /** * Creates a {@code PriorityQueue} with the specified initial capacity * that orders its elements according to the specified comparator.