-
Bug
-
Resolution: Fixed
-
P4
-
19.0.2
-
b17
-
generic
-
generic
-
Verified
The documentation for java.util.concurrent.DelayQueue states:
"The head of the queue is that Delayed element whose delay expired furthest in the past. If no delay has expired there is no head and poll will return null."
However the documentation for the peek() method states:
"Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty. Unlike poll, if no expired elements are available in the queue, this method returns the element that will expire next, if one exists."
With a return value documented as: "the head of this queue, or null if this queue is empty"
I believe the wording that states "If no delay has expired there is no head..." is confusing and inconsistent with the documentation for peek().
"The head of the queue is that Delayed element whose delay expired furthest in the past. If no delay has expired there is no head and poll will return null."
However the documentation for the peek() method states:
"Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty. Unlike poll, if no expired elements are available in the queue, this method returns the element that will expire next, if one exists."
With a return value documented as: "the head of this queue, or null if this queue is empty"
I believe the wording that states "If no delay has expired there is no head..." is confusing and inconsistent with the documentation for peek().
- csr for
-
JDK-8304686 improve DelayQueue removal method javadoc
- Closed