12 |
|
* usage. They are not thread-safe; in the absence of external |
13 |
|
* synchronization, they do not support concurrent access by multiple threads. |
14 |
|
* Null elements are prohibited. This class is likely to be faster than |
15 |
< |
* {@link Stack} when used as as a stack, and faster than {@link LinkedList} |
15 |
> |
* {@link Stack} when used as a stack, and faster than {@link LinkedList} |
16 |
|
* when used as a queue. |
17 |
|
* |
18 |
|
* <p>Most <tt>ArrayDeque</tt> operations run in amortized constant time. |
52 |
|
implements Deque<E>, Cloneable, Serializable |
53 |
|
{ |
54 |
|
/** |
55 |
< |
* The array in which the elements of in the deque are stored. |
55 |
> |
* The array in which the elements of the deque are stored. |
56 |
|
* The capacity of the deque is the length of this array, which is |
57 |
|
* always a power of two. The array is never allowed to become |
58 |
|
* full, except transiently within an addX method where it is |
147 |
|
} |
148 |
|
|
149 |
|
/** |
150 |
< |
* Constructs an empty array deque with the an initial capacity |
150 |
> |
* Constructs an empty array deque with an initial capacity |
151 |
|
* sufficient to hold 16 elements. |
152 |
|
*/ |
153 |
|
public ArrayDeque() { |
503 |
|
|
504 |
|
/** |
505 |
|
* Pops an element from the stack represented by this deque. In other |
506 |
< |
* words, removes and returns the the first element of this deque. |
506 |
> |
* words, removes and returns the first element of this deque. |
507 |
|
* |
508 |
|
* <p>This method is equivalent to {@link #removeFirst()}. |
509 |
|
* |
520 |
|
* adjusting head, tail, and size as necessary. This can result in |
521 |
|
* motion of elements backwards or forwards in the array. |
522 |
|
* |
523 |
< |
* <p>This method is called delete rather than remove to emphasize the |
524 |
< |
* that that its semantics differ from those of List.remove(int). |
523 |
> |
* <p>This method is called delete rather than remove to emphasize |
524 |
> |
* that its semantics differ from those of List.remove(int). |
525 |
|
* |
526 |
|
* @return true if elements moved backwards |
527 |
|
*/ |