Reputation: 27385
As stated in the Deque's javadoc, the Last
-methods (addLast
, removeLast
, etc...) are totally equivalent to the Queue
methods. So it's not clear to me why they declared the Last
-methods in the Deque
interface. Why wouldn't just use the Queue
's methods in the Deque
interface and declare the only First
-methods?
Upvotes: 1
Views: 222
Reputation: 393856
Calling addLast
makes your intent clearer than add
. Code that contains calls to addFirst
and addLast
is easier to understand than code that contains calls to addFirst
add add
.
Upvotes: 1