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

Comparing jsr166/src/main/java/util/Deque.java (file contents):
Revision 1.9 by jsr166, Mon May 16 04:58:20 2005 UTC vs.
Revision 1.15 by jsr166, Mon Jul 18 19:14:17 2005 UTC

# Line 5 | Line 5
5   */
6  
7   package java.util;
8 + import java.util.*; // for javadoc (till 6280605 is fixed)
9  
10   /**
11   * A linear collection that supports element insertion and removal at
# Line 182 | Line 183 | public interface Deque<E> extends Queue<
183      void addFirst(E e);
184  
185      /**
186 <     * Inserts the specified element at the end of this deque  if it is
186 >     * Inserts the specified element at the end of this deque if it is
187       * possible to do so immediately without violating capacity restrictions.
188       * When using a capacity-restricted deque, it is generally preferable to
189       * use method {@link #offerLast}.
190       *
191 +     * <p>This method is equivalent to {@link #add}.
192 +     *
193       * @param e the element to add
194       * @throws IllegalStateException if the element cannot be added at this
195       *         time due to capacity restrictions
# Line 206 | Line 209 | public interface Deque<E> extends Queue<
209       * which can fail to insert an element only by throwing an exception.
210       *
211       * @param e the element to add
212 <     * @return <tt>true</tt> if it was possible to insert the element,
213 <     *         else <tt>false</tt>
212 >     * @return <tt>true</tt> if the element was added to this deque, else
213 >     *         <tt>false</tt>
214       * @throws ClassCastException if the class of the specified element
215       *         prevents it from being added to this deque
216       * @throws NullPointerException if the specified element is null and this
# Line 224 | Line 227 | public interface Deque<E> extends Queue<
227       * which can fail to insert an element only by throwing an exception.
228       *
229       * @param e the element to add
230 <     * @return <tt>true</tt> if it was possible to insert the element,
231 <     *         else <tt>false</tt>
230 >     * @return <tt>true</tt> if the element was added to this deque, else
231 >     *         <tt>false</tt>
232       * @throws ClassCastException if the class of the specified element
233       *         prevents it from being added to this deque
234       * @throws NullPointerException if the specified element is null and this
# Line 237 | Line 240 | public interface Deque<E> extends Queue<
240  
241      /**
242       * Retrieves and removes the first element of this deque.  This method
243 <     * differs from {@link #pollFirst} only in that it throws an exception
244 <     * if this deque is empty.
243 >     * differs from {@link #pollFirst pollFirst} only in that it throws an
244 >     * exception if this deque is empty.
245       *
246       * @return the head of this deque
247       * @throws NoSuchElementException if this deque is empty
# Line 247 | Line 250 | public interface Deque<E> extends Queue<
250  
251      /**
252       * Retrieves and removes the last element of this deque.  This method
253 <     * differs from {@link #pollLast} only in that it throws an exception if
254 <     * this deque is empty.
253 >     * differs from {@link #pollLast pollLast} only in that it throws an
254 >     * exception if this deque is empty.
255       *
256       * @return the tail of this deque
257       * @throws NoSuchElementException if this deque is empty
# Line 273 | Line 276 | public interface Deque<E> extends Queue<
276  
277      /**
278       * Retrieves, but does not remove, the first element of this deque.
279 <     * This method differs from {@link #peekFirst} only in that it throws an
280 <     * exception if this deque is empty.
279 >     *
280 >     * This method differs from {@link #peekFirst peekFirst} only in that it
281 >     * throws an exception if this deque is empty.
282       *
283       * @return the head of this deque
284       * @throws NoSuchElementException if this deque is empty
# Line 283 | Line 287 | public interface Deque<E> extends Queue<
287  
288      /**
289       * Retrieves, but does not remove, the last element of this deque.
290 <     * This method differs from {@link #peekLast} only in that it throws an
291 <     * exception if this deque is empty.
290 >     * This method differs from {@link #peekLast peekLast} only in that it
291 >     * throws an exception if this deque is empty.
292       *
293       * @return the tail of this deque
294       * @throws NoSuchElementException if this deque is empty
# Line 313 | Line 317 | public interface Deque<E> extends Queue<
317       * More formally, removes the first element <tt>e</tt> such that
318       * <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>
319       * (if such an element exists).
320 <     * Returns true if this deque contained the specified element (or
321 <     * equivalently, if this deque changed as a result of the call).
320 >     * Returns <tt>true</tt> if this deque contained the specified element
321 >     * (or equivalently, if this deque changed as a result of the call).
322       *
323       * @param o element to be removed from this deque, if present
324       * @return <tt>true</tt> if an element was removed as a result of this call
# Line 331 | Line 335 | public interface Deque<E> extends Queue<
335       * More formally, removes the last element <tt>e</tt> such that
336       * <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>
337       * (if such an element exists).
338 <     * Returns true if this deque contained the specified element (or
339 <     * equivalently, if this deque changed as a result of the call).
338 >     * Returns <tt>true</tt> if this deque contained the specified element
339 >     * (or equivalently, if this deque changed as a result of the call).
340       *
341       * @param o element to be removed from this deque, if present
342       * @return <tt>true</tt> if an element was removed as a result of this call
# Line 354 | Line 358 | public interface Deque<E> extends Queue<
358       * When using a capacity-restricted deque, it is generally preferable to
359       * use {@link #offer(Object) offer}.
360       *
361 <     * <p>This method is equivalent to {@link #addLast(Object) addLast}.
361 >     * <p>This method is equivalent to {@link #addLast}.
362       *
363       * @param e the element to add
364 <     * @return <tt>true</tt> (as per the spec for {@link Collection#add})
364 >     * @return <tt>true</tt> (as specified by {@link Collection#add})
365       * @throws IllegalStateException if the element cannot be added at this
366       *         time due to capacity restrictions
367       * @throws ClassCastException if the class of the specified element
# Line 395 | Line 399 | public interface Deque<E> extends Queue<
399      /**
400       * Retrieves and removes the head of the queue represented by this deque
401       * (in other words, the first element of this deque).
402 <     * This method differs from {@link #poll} only in that it throws an
402 >     * This method differs from {@link #poll poll} only in that it throws an
403       * exception if this deque is empty.
404       *
405       * <p>This method is equivalent to {@link #removeFirst()}.
# Line 420 | Line 424 | public interface Deque<E> extends Queue<
424      /**
425       * Retrieves, but does not remove, the head of the queue represented by
426       * this deque (in other words, the first element of this deque).
427 <     * This method differs from {@link #peek} only in that it throws an
427 >     * This method differs from {@link #peek peek} only in that it throws an
428       * exception if this deque is empty.
429       *
430       * <p>This method is equivalent to {@link #getFirst()}.
# Line 487 | Line 491 | public interface Deque<E> extends Queue<
491       * More formally, removes the first element <tt>e</tt> such that
492       * <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>
493       * (if such an element exists).
494 <     * Returns true if this deque contained the specified element (or
495 <     * equivalently, if this deque changed as a result of the call).
494 >     * Returns <tt>true</tt> if this deque contained the specified element
495 >     * (or equivalently, if this deque changed as a result of the call).
496       *
497       * <p>This method is equivalent to {@link #removeFirstOccurrence}.
498       *
# Line 524 | Line 528 | public interface Deque<E> extends Queue<
528      public int size();
529  
530      /**
531 <     * Returns an iterator over the elements in this deque.  The elements
532 <     * will be ordered from first (head) to last (tail).
531 >     * Returns an iterator over the elements in this deque in proper sequence.
532 >     * The elements will be returned in order from first (head) to last (tail).
533       *
534 <     * @return an <tt>Iterator</tt> over the elements in this deque
534 >     * @return an iterator over the elements in this deque in proper sequence
535       */
536      Iterator<E> iterator();
537   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines