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

Comparing jsr166/src/main/java/util/AbstractQueue.java (file contents):
Revision 1.27 by jsr166, Mon May 2 08:35:49 2005 UTC vs.
Revision 1.28 by jsr166, Sat May 14 01:55:29 2005 UTC

# Line 43 | Line 43 | public abstract class AbstractQueue<E>
43      protected AbstractQueue() {
44      }
45  
46
46      /**
47 <     * Adds the specified element to this queue. This implementation
48 <     * returns <tt>true</tt> if <tt>offer</tt> succeeds, else
49 <     * throws an IllegalStateException.
50 <     *
51 <     * @param e the element
52 <     * @return <tt>true</tt> (as per the general contract of
53 <     *         <tt>Collection.add</tt>).
54 <     *
55 <     * @throws NullPointerException if the specified element is <tt>null</tt>.
56 <     * @throws IllegalStateException if the element cannot be added.
47 >     * Inserts the specified element into this queue if it is possible to do so
48 >     * immediately without violating capacity restrictions, returning
49 >     * <tt>true</tt> upon success and throwing an <tt>IllegalStateException</tt>
50 >     * if no space is currently available.
51 >     *
52 >     * <p>This implementation returns <tt>true</tt> if <tt>offer</tt> succeeds,
53 >     * else throws an <tt>IllegalStateException</tt>.
54 >     *
55 >     * @param e the element to add
56 >     * @return <tt>true</tt> (as per the spec for {@link Collection#add})
57 >     * @throws IllegalStateException if the element cannot be added at this
58 >     *         time due to capacity restrictions
59 >     * @throws NullPointerException if the specified element is null and
60 >     *         this queue not permit null elements
61 >     * @throws ClassCastException if the class of the specified element
62 >     *         prevents it from being added to this queue
63 >     * @throws IllegalArgumentException if some property of this element
64 >     *         prevents it from being added to this queue
65       */
66      public boolean add(E e) {
67          if (offer(e))
# Line 64 | Line 71 | public abstract class AbstractQueue<E>
71      }
72  
73      /**
74 <     * Retrieves and removes the head of this queue.
75 <     * This implementation returns the result of <tt>poll</tt>
74 >     * Retrieves and removes the head of this queue.  This method differs
75 >     * from {@link #poll} only in that it throws an exception if this queue
76 >     * is empty.
77 >     *
78 >     * <p>This implementation returns the result of <tt>poll</tt>
79       * unless the queue is empty.
80       *
81 <     * @return the head of this queue.
82 <     * @throws NoSuchElementException if this queue is empty.
81 >     * @return the head of this queue
82 >     * @throws NoSuchElementException if this queue is empty
83       */
84      public E remove() {
85          E x = poll();
# Line 80 | Line 90 | public abstract class AbstractQueue<E>
90      }
91  
92      /**
93 <     * Retrieves, but does not remove, the head of this queue.
94 <     * This implementation returns the result of <tt>peek</tt>
93 >     * Retrieves, but does not remove, the head of this queue.  This method
94 >     * differs from {@link #peek} only in that it throws an exception if
95 >     * this queue is empty.
96 >     *
97 >     * <p>This implementation returns the result of <tt>peek</tt>
98       * unless the queue is empty.
99       *
100 <     * @return the head of this queue.
101 <     * @throws NoSuchElementException if this queue is empty.
100 >     * @return the head of this queue
101 >     * @throws NoSuchElementException if this queue is empty
102       */
103      public E element() {
104          E x = peek();
# Line 98 | Line 111 | public abstract class AbstractQueue<E>
111      /**
112       * Removes all of the elements from this queue.
113       * The queue will be empty after this call returns.
114 +     *
115       * <p>This implementation repeatedly invokes {@link #poll poll} until it
116       * returns <tt>null</tt>.
117       */
# Line 121 | Line 135 | public abstract class AbstractQueue<E>
135       * having been successfully added when the associated exception is
136       * thrown.
137       *
138 <     * @param c collection whose elements are to be added to this queue.
139 <     * @return <tt>true</tt> if this queue changed as a result of the
140 <     *         call.
141 <     * @throws NullPointerException if the specified collection or
142 <     *         any of its elements are null.
143 <     * @throws IllegalArgumentException if c is this queue.
144 <     *
138 >     * @param c collection whose elements are to be added to this queue
139 >     * @return <tt>true</tt> if this queue changed as a result of the call
140 >     * @throws NullPointerException if the specified collection contains a
141 >     *         null element and this queue does not permit null elements,
142 >     *         or if the specified collection is null
143 >     * @throws ClassCastException if the class of an element of the specified
144 >     *         collection prevents it from being added to this queue
145 >     * @throws IllegalArgumentException if some property of an element of the
146 >     *         specified collection prevents it from being added to this
147 >     *         queue, or if the specified collection is this queue
148 >     * @throws IllegalStateException if not all the elements can be added at
149 >     *         this time due to insertion restrictions
150       * @see #add(Object)
151       */
152      public boolean addAll(Collection<? extends E> c) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines