19 |
|
* operations or sublists. |
20 |
|
* |
21 |
|
* <p>A view of a subset of Deque operations can be obtained using |
22 |
< |
* method {@link #asFIFO} to support only Last-In-First-Out (LIFO) |
23 |
< |
* stack behavior, as well as method {@link #asFIFO} to support only |
22 |
> |
* method {@link #asFifoQueue} to support only Last-In-First-Out (LIFO) |
23 |
> |
* stack behavior, as well as method {@link #asFifoQueue} to support only |
24 |
|
* First-in-First-Out (FIFO) queue behavior. More commonly, a Deque |
25 |
|
* is used when various mixtures of LIFO and FIFO operations are |
26 |
|
* required. |
27 |
|
* |
28 |
< |
* <p>Deques additionally provide a few methods to manipulate elements |
29 |
< |
* embedded within a deque, proceding from either direction: |
30 |
< |
* <tt>removeFirstOccurrence</tt>, <tt>replaceFirstOccurrence</tt> |
31 |
< |
* <tt>removeLastOccurrence</tt>, and <tt>replaceLastOccurrence</tt>. |
28 |
> |
* <p>Deques additionally provide a few methods to remove elements |
29 |
> |
* embedded within a deque, proceding from either direction using |
30 |
> |
* <tt>removeFirstOccurrence</tt> and <tt>removeLastOccurrence</tt>. |
31 |
|
* They also support {@link Collection} operations including |
32 |
|
* <tt>contains</tt>, <tt>iterator</tt>, and so on. |
33 |
|
* |
213 |
|
boolean removeLastOccurrence(E o); |
214 |
|
|
215 |
|
/** |
217 |
– |
* Replaces the first occurrence of the specified element in this |
218 |
– |
* deque. If the deque does not contain the element, it is |
219 |
– |
* unchanged. More formally, replaces the first element <tt>e</tt> |
220 |
– |
* such that <tt>(o==null ? e==null : o.equals(e))</tt> (if |
221 |
– |
* such an element exists). |
222 |
– |
* |
223 |
– |
* @param oldElement element to be replaced in this deque, if present. |
224 |
– |
* @param newElement replacement value |
225 |
– |
* @return <tt>true</tt> if an element was replaced |
226 |
– |
*/ |
227 |
– |
public boolean replaceFirstOccurrence(E oldElement, E newElement); |
228 |
– |
|
229 |
– |
/** |
230 |
– |
* Replaces the last occurrence of the specified element in this |
231 |
– |
* deque. If the deque does not contain the element, it is |
232 |
– |
* unchanged. More formally, replaces the last element <tt>e</tt> |
233 |
– |
* such that <tt>(o==null ? e==null : o.equals(e))</tt> (if |
234 |
– |
* such an element exists). |
235 |
– |
* |
236 |
– |
* @param oldElement element to be replaced in this deque, if present. |
237 |
– |
* @param newElement replacement value |
238 |
– |
* @return <tt>true</tt> if an element was replaced |
239 |
– |
*/ |
240 |
– |
public boolean replaceLastOccurrence(E oldElement, E newElement); |
241 |
– |
|
242 |
– |
/** |
216 |
|
* Returns a view of this deque as a first-in-first-out queue, |
217 |
|
* mapping {@link Queue#offer} to <tt>offerLast</tt>, {@link |
218 |
|
* Queue#poll} to <tt>pollFirst</tt>, and other operations |
219 |
|
* accordingly. |
220 |
|
* @return a first-in-first-out view of this deque. |
221 |
|
*/ |
222 |
< |
public Queue<E> asFIFO(); |
222 |
> |
public Queue<E> asFifoQueue(); |
223 |
|
|
224 |
|
/** |
225 |
< |
* Returns a view of this deque as a first-in-Last-out stack, |
225 |
> |
* Returns a view of this deque as a last-in-first-out stack, |
226 |
|
* mapping {@link Queue#offer} to <tt>offerFirst</tt>, {@link |
227 |
|
* Queue#poll} to <tt>pollFirst</tt>, and other operations |
228 |
|
* accordingly. |
229 |
|
* @return a first-in-last-out view of this deque. |
230 |
|
*/ |
231 |
< |
public Queue<E> asLIFO(); |
231 |
> |
public Queue<E> asLifoQueue(); |
232 |
|
|
233 |
|
} |