Hi Turkhan, this mail belongs to core-libs-dev list. I have forwarded your mail to the right list.
Indeed, we should claim that peek() is equivalent to peekFirst(); the information in stack section should be a typo, as peek() being the same as peekFirst() is claimed by the deque section and the peek() specification. I have created a ticket on the Java Bug System to track this issue: [JDK-8337205] Typo in Stack vs Deque Method table in Deque specification - Java Bug System (openjdk.org)<https://bugs.openjdk.org/browse/JDK-8337205> Feel free to open a pull request to jdk to fix this bug. Best, Chen Liang ________________________________ From: jdk-dev <jdk-dev-r...@openjdk.org> on behalf of Turkhan Badalov <badalov.tur...@gmail.com> Sent: Thursday, July 25, 2024 4:58 AM To: jdk-...@openjdk.org <jdk-...@openjdk.org> Subject: Should the documentation state peekFirst() as equivalent to Stack's peek()? 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.