-
Bug
-
Resolution: Fixed
-
P4
-
7, 8, 9, 10, 11
-
b09
-
Not verified
A DESCRIPTION OF THE PROBLEM :
There is a table in the front part about Comparison of Stack and Deque methods.
It is stated that the Stack method peek() is equivalent to the Deque method peekFirst(). However, it is not. The Stack's method peek() will throw EmptyStackException if the stack is empty. However, Deque's method peekFirst() will return null if this deque is empty.
I think Stack method peek() is equivalent to the Deque method getFirst(), where it will throw NoSuchElementException if this deque is empty. Even though these two exceptions are not same, at least it is not totally different behaviour.
This docs remains same for Java SE7, 8 and 9:
https://docs.oracle.com/javase/7/docs/api/java/util/Deque.html
https://docs.oracle.com/javase/8/docs/api/java/util/Deque.html
https://docs.oracle.com/javase/9/docs/api/java/util/Deque.html
URL OF FAULTY DOCUMENTATION :
https://docs.oracle.com/javase/8/docs/api/java/util/Deque.html
There is a table in the front part about Comparison of Stack and Deque methods.
It is stated that the Stack method peek() is equivalent to the Deque method peekFirst(). However, it is not. The Stack's method peek() will throw EmptyStackException if the stack is empty. However, Deque's method peekFirst() will return null if this deque is empty.
I think Stack method peek() is equivalent to the Deque method getFirst(), where it will throw NoSuchElementException if this deque is empty. Even though these two exceptions are not same, at least it is not totally different behaviour.
This docs remains same for Java SE7, 8 and 9:
https://docs.oracle.com/javase/7/docs/api/java/util/Deque.html
https://docs.oracle.com/javase/8/docs/api/java/util/Deque.html
https://docs.oracle.com/javase/9/docs/api/java/util/Deque.html
URL OF FAULTY DOCUMENTATION :
https://docs.oracle.com/javase/8/docs/api/java/util/Deque.html