ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/ArrayDeque.java
(Generate patch)

Comparing jsr166/src/main/java/util/ArrayDeque.java (file contents):
Revision 1.5 by dl, Tue Mar 22 01:29:00 2005 UTC vs.
Revision 1.8 by jsr166, Mon May 2 04:19:58 2005 UTC

# Line 24 | Line 24 | import java.io.*;
24   *
25   * <p>The iterators returned by this class's <tt>iterator</tt> method are
26   * <i>fail-fast</i>: If the deque is modified at any time after the iterator
27 < * is created, in any way except through the iterator's own remove method, the
28 < * iterator will generally throw a {@link ConcurrentModificationException}.
29 < * Thus, in the face of concurrent modification, the iterator fails quickly
30 < * and cleanly, rather than risking arbitrary, non-deterministic behavior at
31 < * an undetermined time in the future.
27 > * is created, in any way except through the iterator's own <tt>remove</tt>
28 > * method, the iterator will generally throw a {@link
29 > * ConcurrentModificationException}.  Thus, in the face of concurrent
30 > * modification, the iterator fails quickly and cleanly, rather than risking
31 > * arbitrary, non-deterministic behavior at an undetermined time in the
32 > * future.
33   *
34   * <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
35   * as it is, generally speaking, impossible to make any hard guarantees in the
# Line 129 | Line 130 | public class ArrayDeque<E> extends Abstr
130      }
131  
132      /**
133 <     * Copy the elements from our element array into the specified array,
133 >     * Copies the elements from our element array into the specified array,
134       * in order (from first to last element in the deque).  It is assumed
135       * that the array is large enough to hold all elements in the deque.
136       *
# Line 198 | Line 199 | public class ArrayDeque<E> extends Abstr
199      }
200  
201      /**
202 <     * Inserts the specified element to the end of this deque.
202 >     * Inserts the specified element at the end of this deque.
203       * This method is equivalent to {@link Collection#add} and
204       * {@link #push}.
205       *
# Line 260 | Line 261 | public class ArrayDeque<E> extends Abstr
261      }
262  
263      /**
264 <     * Inserts the specified element to the end of this deque.
264 >     * Inserts the specified element at the end of this deque.
265       *
266       * @param e the element to insert
267       * @return <tt>true</tt> (as per the spec for {@link Deque#offerLast})
# Line 273 | Line 274 | public class ArrayDeque<E> extends Abstr
274  
275      /**
276       * Retrieves and removes the first element of this deque.  This method
277 <     * differs from the <tt>pollFirst</tt> method in that it throws an
277 >     * differs from the {@link #pollFirst} method only in that it throws an
278       * exception if this deque is empty.
279       *
280       * @return the first element of this deque
# Line 288 | Line 289 | public class ArrayDeque<E> extends Abstr
289  
290      /**
291       * Retrieves and removes the last element of this deque.  This method
292 <     * differs from the <tt>pollLast</tt> method in that it throws an
292 >     * differs from the {@link #pollLast} method only in that it throws an
293       * exception if this deque is empty.
294       *
295       * @return the last element of this deque
# Line 325 | Line 326 | public class ArrayDeque<E> extends Abstr
326  
327      /**
328       * Retrieves, but does not remove, the first element of this
329 <     * deque.  This method differs from the <tt>peekFirst</tt> method only
329 >     * deque.  This method differs from the {@link #peekFirst} method only
330       * in that it throws an exception if this deque is empty.
331       *
332       * @return the first element of this deque
# Line 340 | Line 341 | public class ArrayDeque<E> extends Abstr
341  
342      /**
343       * Retrieves, but does not remove, the last element of this
344 <     * deque.  This method differs from the <tt>peekLast</tt> method only
344 >     * deque.  This method differs from the {@link #peekLast} method only
345       * in that it throws an exception if this deque is empty.
346       *
347       * @return the last element of this deque
# Line 408 | Line 409 | public class ArrayDeque<E> extends Abstr
409      // *** Queue methods ***
410  
411      /**
412 <     * Inserts the specified element to the end of this deque.
412 >     * Inserts the specified element at the end of this deque.
413       *
414       * <p>This method is equivalent to {@link #offerLast}.
415       *
# Line 421 | Line 422 | public class ArrayDeque<E> extends Abstr
422      }
423  
424      /**
425 <     * Inserts the specified element to the end of this deque.
425 >     * Inserts the specified element at the end of this deque.
426       *
427       * <p>This method is equivalent to {@link #addLast}.
428       *
# Line 451 | Line 452 | public class ArrayDeque<E> extends Abstr
452  
453      /**
454       * Retrieves and removes the head of the queue represented by this deque.
455 <     * This method differs from the <tt>poll</tt> method in that it throws an
456 <     * exception if this deque is empty.
455 >     * This method differs from the {@link #poll} method only in that it
456 >     * throws an exception if this deque is empty.
457       *
458       * <p>This method is equivalent to {@link #removeFirst}.
459       *
# Line 467 | Line 468 | public class ArrayDeque<E> extends Abstr
468       * Retrieves, but does not remove, the head of the queue represented by
469       * this deque, returning <tt>null</tt> if this deque is empty.
470       *
471 <     * <p>This method is equivalent to {@link #peekFirst}
471 >     * <p>This method is equivalent to {@link #peekFirst}.
472       *
473       * @return the head of the queue represented by this deque, or
474       *     <tt>null</tt> if this deque is empty
# Line 478 | Line 479 | public class ArrayDeque<E> extends Abstr
479  
480      /**
481       * Retrieves, but does not remove, the head of the queue represented by
482 <     * this deque.  This method differs from the <tt>peek</tt> method only in
482 >     * this deque.  This method differs from the {@link #peek} method only in
483       * that it throws an exception if this deque is empty.
484       *
485 <     * <p>This method is equivalent to {@link #getFirst}
485 >     * <p>This method is equivalent to {@link #getFirst}.
486       *
487       * @return the head of the queue represented by this deque
488       * @throws NoSuchElementException if this deque is empty
# Line 520 | Line 521 | public class ArrayDeque<E> extends Abstr
521      }
522  
523      /**
524 <     * Remove the element at the specified position in the elements array,
524 >     * Removes the element at the specified position in the elements array,
525       * adjusting head, tail, and size as necessary.  This can result in
526       * motion of elements backwards or forwards in the array.
527       *
# Line 558 | Line 559 | public class ArrayDeque<E> extends Abstr
559      }
560  
561      /**
562 <     * Returns <tt>true</tt> if this collection contains no elements.<p>
562 >     * Returns <tt>true</tt> if this deque contains no elements.<p>
563       *
564 <     * @return <tt>true</tt> if this collection contains no elements.
564 >     * @return <tt>true</tt> if this deque contains no elements.
565       */
566      public boolean isEmpty() {
567          return head == tail;
# Line 659 | Line 660 | public class ArrayDeque<E> extends Abstr
660  
661      /**
662       * Removes all of the elements from this deque.
663 +     * The deque will be empty after this call returns.
664       */
665      public void clear() {
666          int h = head;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines