<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Turkhan, this mail belongs to core-libs-dev list. I have forwarded your mail to the right list.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have created a ticket on the Java Bug System to track this issue: <a href="https://bugs.openjdk.org/browse/JDK-8337205" id="OWA15d67861-18eb-83ea-f68a-44cf3e158be6" class="OWAAutoLink">
[JDK-8337205] Typo in Stack vs Deque Method table in Deque specification - Java Bug System (openjdk.org)</a></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Feel free to open a pull request to jdk to fix this bug.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best, Chen Liang</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> jdk-dev <jdk-dev-retn@openjdk.org> on behalf of Turkhan Badalov <badalov.turxan@gmail.com><br>
<b>Sent:</b> Thursday, July 25, 2024 4:58 AM<br>
<b>To:</b> jdk-dev@openjdk.org <jdk-dev@openjdk.org><br>
<b>Subject:</b> Should the documentation state peekFirst() as equivalent to Stack's peek()?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Here is the table "Comparison of Stack and Deque methods" that lists equivalent Deque methods compared to Stack methods:
<a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Deque.html">
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Deque.html</a></div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>In fact, the documentation of the peek() method itself says that this method is equivalent to peekFirst():
<a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Deque.html#peek()">
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Deque.html#peek()</a>.</div>
<div><br>
</div>
<div>If this should be posted somewhere else, please let me know. I am still new to using mailing lists. Cheers.<br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</body>
</html>