112 |
|
* <p>Deques can also be used as LIFO (Last-In-First-Out) stacks. This |
113 |
|
* interface should be used in preference to the legacy {@link Stack} class. |
114 |
|
* When a deque is used as a stack, elements are pushed and popped from the |
115 |
< |
* beginning of the deque. Stack methods are precisely equivalent to |
116 |
< |
* {@code Deque} methods as indicated in the table below: |
115 |
> |
* beginning of the deque. Stack methods are equivalent to {@code Deque} |
116 |
> |
* methods as indicated in the table below: |
117 |
|
* |
118 |
|
* <table class="striped"> |
119 |
|
* <caption>Comparison of Stack and Deque methods</caption> |
134 |
|
* </tr> |
135 |
|
* <tr> |
136 |
|
* <th scope="row">{@link #peek() peek()}</th> |
137 |
< |
* <td>{@link #peekFirst() peekFirst()}</td> |
137 |
> |
* <td>{@link #getFirst() getFirst()}</td> |
138 |
|
* </tr> |
139 |
|
* </tbody> |
140 |
|
* </table> |
164 |
|
* {@code Object}. |
165 |
|
* |
166 |
|
* <p>This interface is a member of the |
167 |
< |
* <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework"> |
167 |
> |
* <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework"> |
168 |
|
* Java Collections Framework</a>. |
169 |
|
* |
170 |
|
* @author Doug Lea |
334 |
|
* @return {@code true} if an element was removed as a result of this call |
335 |
|
* @throws ClassCastException if the class of the specified element |
336 |
|
* is incompatible with this deque |
337 |
< |
* (<a href="{@docRoot}/../api/java/util/Collection.html#optional-restrictions">optional</a>) |
337 |
> |
* (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>) |
338 |
|
* @throws NullPointerException if the specified element is null and this |
339 |
|
* deque does not permit null elements |
340 |
< |
* (<a href="{@docRoot}/../api/java/util/Collection.html#optional-restrictions">optional</a>) |
340 |
> |
* (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>) |
341 |
|
*/ |
342 |
|
boolean removeFirstOccurrence(Object o); |
343 |
|
|
353 |
|
* @return {@code true} if an element was removed as a result of this call |
354 |
|
* @throws ClassCastException if the class of the specified element |
355 |
|
* is incompatible with this deque |
356 |
< |
* (<a href="{@docRoot}/../api/java/util/Collection.html#optional-restrictions">optional</a>) |
356 |
> |
* (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>) |
357 |
|
* @throws NullPointerException if the specified element is null and this |
358 |
|
* deque does not permit null elements |
359 |
< |
* (<a href="{@docRoot}/../api/java/util/Collection.html#optional-restrictions">optional</a>) |
359 |
> |
* (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>) |
360 |
|
*/ |
361 |
|
boolean removeLastOccurrence(Object o); |
362 |
|
|
536 |
|
* @return {@code true} if an element was removed as a result of this call |
537 |
|
* @throws ClassCastException if the class of the specified element |
538 |
|
* is incompatible with this deque |
539 |
< |
* (<a href="{@docRoot}/../api/java/util/Collection.html#optional-restrictions">optional</a>) |
539 |
> |
* (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>) |
540 |
|
* @throws NullPointerException if the specified element is null and this |
541 |
|
* deque does not permit null elements |
542 |
< |
* (<a href="{@docRoot}/../api/java/util/Collection.html#optional-restrictions">optional</a>) |
542 |
> |
* (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>) |
543 |
|
*/ |
544 |
|
boolean remove(Object o); |
545 |
|
|
552 |
|
* @return {@code true} if this deque contains the specified element |
553 |
|
* @throws ClassCastException if the class of the specified element |
554 |
|
* is incompatible with this deque |
555 |
< |
* (<a href="{@docRoot}/../api/java/util/Collection.html#optional-restrictions">optional</a>) |
555 |
> |
* (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>) |
556 |
|
* @throws NullPointerException if the specified element is null and this |
557 |
|
* deque does not permit null elements |
558 |
< |
* (<a href="{@docRoot}/../api/java/util/Collection.html#optional-restrictions">optional</a>) |
558 |
> |
* (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>) |
559 |
|
*/ |
560 |
|
boolean contains(Object o); |
561 |
|
|