426 |
|
|
427 |
|
/** |
428 |
|
* Returns an iterator over all the elements (both expired and |
429 |
< |
* unexpired) in this queue. The iterator does not |
430 |
< |
* return the elements in any particular order. |
429 |
> |
* unexpired) in this queue. The iterator does not return the |
430 |
> |
* elements in any particular order. The returned |
431 |
> |
* <tt>Iterator</tt> is a "weakly consistent" iterator that will |
432 |
> |
* never throw {@link ConcurrentModificationException}, and |
433 |
> |
* guarantees to traverse elements as they existed upon |
434 |
> |
* construction of the iterator, and may (but is not guaranteed |
435 |
> |
* to) reflect any modifications subsequent to construction. |
436 |
|
* |
437 |
|
* @return an iterator over the elements in this queue |
438 |
|
*/ |
439 |
|
public Iterator<E> iterator() { |
440 |
< |
return new Itr<E>(toArray()); |
440 |
> |
return new Itr(toArray()); |
441 |
|
} |
442 |
|
|
443 |
|
/** |
444 |
|
* Snapshot iterator that works off copy of underlying q array. |
445 |
|
*/ |
446 |
< |
private class Itr<E> implements Iterator<E> { |
446 |
> |
private class Itr implements Iterator<E> { |
447 |
|
final Object[] array; // Array of all elements |
448 |
|
int cursor; // index of next element to return; |
449 |
|
int lastRet; // index of last element, or -1 if no such |