Details
-
Enhancement
-
Resolution: Fixed
-
P5
-
6u10
-
b102
-
x86
-
windows_xp
-
Verified
Description
A DESCRIPTION OF THE REQUEST :
The class java.util.PriorityQueue has no constructor with signature (Comparator). The constructor that comes closest to it requires an initial capacity and a comparator. However, the initial capacity is an implementation detail that should not be necessary in most cases.
JUSTIFICATION :
This enhancement is simple in the first place.
It is hard to explain why a comparator should be tied to an initial capacity. Since the comparator cannot be changed afterwards, it has to be provided in the constructor for an empty PriorityQueue.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
new PriorityQueue(comparator) should be possible.
ACTUAL -
new PriorityQueue(11, comparator) is an ugly workaround.
CUSTOMER SUBMITTED WORKAROUND :
Use new PriorityQueue(11, comparator) instead (ugly).
The class java.util.PriorityQueue has no constructor with signature (Comparator). The constructor that comes closest to it requires an initial capacity and a comparator. However, the initial capacity is an implementation detail that should not be necessary in most cases.
JUSTIFICATION :
This enhancement is simple in the first place.
It is hard to explain why a comparator should be tied to an initial capacity. Since the comparator cannot be changed afterwards, it has to be provided in the constructor for an empty PriorityQueue.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
new PriorityQueue(comparator) should be possible.
ACTUAL -
new PriorityQueue(11, comparator) is an ugly workaround.
CUSTOMER SUBMITTED WORKAROUND :
Use new PriorityQueue(11, comparator) instead (ugly).
Attachments
Issue Links
- relates to
-
JDK-8021601 Unit test for PriorityQueue(Comparator)
- Closed