45 |
|
} |
46 |
|
|
47 |
|
/** |
48 |
< |
* Add the specified element to this delay queue. |
48 |
> |
* Inserts the specified element to this delay queue. |
49 |
|
* |
50 |
+ |
* @param o the element to add |
51 |
|
* @return <tt>true</tt> |
52 |
< |
* @throws NullPointerException {@inheritDoc} |
52 |
> |
* @throws NullPointerException if the specified element is <tt>null</tt>. |
53 |
|
*/ |
54 |
|
public boolean offer(E o) { |
55 |
|
lock.lock(); |
68 |
|
/** |
69 |
|
* Adds the specified element to this delay queue. As the queue is |
70 |
|
* unbounded this method will never block. |
71 |
< |
* @throws NullPointerException {@inheritDoc} |
71 |
> |
* @param o the element to add |
72 |
> |
* @throws NullPointerException if the specified element is <tt>null</tt>. |
73 |
|
*/ |
74 |
|
public void put(E o) { |
75 |
|
offer(o); |
76 |
|
} |
77 |
|
|
78 |
|
/** |
79 |
< |
* Adds the specified element to this priority queue. As the queue is |
79 |
> |
* Adds the specified element to this delay queue. As the queue is |
80 |
|
* unbounded this method will never block. |
81 |
< |
* @param o {@inheritDoc} |
82 |
< |
* @param time This parameter is ignored as the method never blocks |
81 |
> |
* @param o the element to add |
82 |
> |
* @param timeout This parameter is ignored as the method never blocks |
83 |
|
* @param unit This parameter is ignored as the method never blocks |
82 |
– |
* @throws NullPointerException {@inheritDoc} |
84 |
|
* @return <tt>true</tt> |
85 |
+ |
* @throws NullPointerException if the specified element is <tt>null</tt>. |
86 |
|
*/ |
87 |
< |
public boolean offer(E o, long time, TimeUnit unit) { |
87 |
> |
public boolean offer(E o, long timeout, TimeUnit unit) { |
88 |
|
return offer(o); |
89 |
|
} |
90 |
|
|
91 |
|
/** |
92 |
|
* Adds the specified element to this queue. |
93 |
+ |
* @param o the element to add |
94 |
|
* @return <tt>true</tt> (as per the general contract of |
95 |
|
* <tt>Collection.add</tt>). |
96 |
|
* |
97 |
< |
* @throws NullPointerException {@inheritDoc} |
97 |
> |
* @throws NullPointerException if the specified element is <tt>null</tt>. |
98 |
|
*/ |
99 |
|
public boolean add(E o) { |
100 |
|
return offer(o); |
235 |
|
} |
236 |
|
} |
237 |
|
|
235 |
– |
/** |
236 |
– |
* Removes a single instance of the specified element from this |
237 |
– |
* queue, if it is present. More formally, |
238 |
– |
* removes an element <tt>e</tt> such that <tt>(o==null ? e==null : |
239 |
– |
* o.equals(e))</tt>, if the queue contains one or more such |
240 |
– |
* elements. Returns <tt>true</tt> if the queue contained the |
241 |
– |
* specified element (or equivalently, if the queue changed as a |
242 |
– |
* result of the call). |
243 |
– |
* |
244 |
– |
* <p>This implementation iterates over the queue looking for the |
245 |
– |
* specified element. If it finds the element, it removes the element |
246 |
– |
* from the queue using the iterator's remove method.<p> |
247 |
– |
* |
248 |
– |
*/ |
238 |
|
public boolean remove(Object o) { |
239 |
|
lock.lock(); |
240 |
|
try { |