Returns an iterator for the items in the queue. Remove is supported. If Collections#allocateIterators is false, the same iterator instance is returned each time this method is called. Use the QueueIterator constructor for nested or multithreaded iteration.
()
| 339 | * If {@link Collections#allocateIterators} is false, the same iterator instance is returned each time this method is called. |
| 340 | * Use the {@link QueueIterator} constructor for nested or multithreaded iteration. */ |
| 341 | public Iterator<T> iterator () { |
| 342 | if (Collections.allocateIterators) return new QueueIterator(this, true); |
| 343 | if (iterable == null) iterable = new QueueIterable(this); |
| 344 | return iterable.iterator(); |
| 345 | } |
| 346 | |
| 347 | public String toString () { |
| 348 | if (size == 0) { |
no outgoing calls