Should the documentation state peekFirst() as equivalent to Stack's peek()?

Turkhan Badalov badalov.turxan at gmail.com
Thu Jul 25 09:58:56 UTC 2024


Here is the table "Comparison of Stack and Deque methods" that lists
equivalent Deque methods compared to Stack methods:
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Deque.html

At the moment, getFirst() is said to be equivalent to peek(). Since peek()
doesn't throw an exception when the queue/stack is empty, peekFirst() could
be a better equivalent because getFirst() throws.

In fact, the documentation of the peek() method itself says that this
method is equivalent to peekFirst():
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Deque.html#peek()
.

If this should be posted somewhere else, please let me know. I am still new
to using mailing lists. Cheers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jdk-dev/attachments/20240725/3c76d41f/attachment-0001.htm>


More information about the jdk-dev mailing list