6 |
|
*/ |
7 |
|
|
8 |
|
package java.util; |
9 |
– |
import java.util.*; // for javadoc (till 6280605 is fixed) |
9 |
|
import java.io.Serializable; |
10 |
|
import java.io.ObjectOutputStream; |
11 |
|
import java.io.IOException; |
2220 |
|
public Object[] toArray() { return c.toArray(); } |
2221 |
|
public <T> T[] toArray(T[] a) { return c.toArray(a); } |
2222 |
|
public String toString() { return c.toString(); } |
2224 |
– |
public Iterator<E> iterator() { return c.iterator(); } |
2223 |
|
public boolean remove(Object o) { return c.remove(o); } |
2224 |
|
public boolean containsAll(Collection<?> coll) { |
2225 |
|
return c.containsAll(coll); |
2234 |
|
c.clear(); |
2235 |
|
} |
2236 |
|
|
2237 |
< |
public boolean add(E e){ |
2237 |
> |
public Iterator<E> iterator() { |
2238 |
> |
return new Iterator<E>() { |
2239 |
> |
private final Iterator<E> it = c.iterator(); |
2240 |
> |
public boolean hasNext() { return it.hasNext(); } |
2241 |
> |
public E next() { return it.next(); } |
2242 |
> |
public void remove() { it.remove(); }}; |
2243 |
> |
} |
2244 |
> |
|
2245 |
> |
public boolean add(E e){ |
2246 |
|
typeCheck(e); |
2247 |
|
return c.add(e); |
2248 |
|
} |
3504 |
|
* </pre> |
3505 |
|
* |
3506 |
|
* @param c the collection into which <tt>elements</tt> are to be inserted |
3507 |
< |
* @param a the elements to insert into <tt>c</tt> |
3507 |
> |
* @param elements the elements to insert into <tt>c</tt> |
3508 |
|
* @return <tt>true</tt> if the collection changed as a result of the call |
3509 |
|
* @throws UnsupportedOperationException if <tt>c</tt> does not support |
3510 |
< |
* the <tt>add</tt> operation. |
3510 |
> |
* the <tt>add</tt> operation |
3511 |
|
* @throws NullPointerException if <tt>elements</tt> contains one or more |
3512 |
|
* null values and <tt>c</tt> does not permit null elements, or |
3513 |
|
* if <tt>c</tt> or <tt>elements</tt> are <tt>null</tt> |
3516 |
|
* @see Collection#addAll(Collection) |
3517 |
|
* @since 1.5 |
3518 |
|
*/ |
3519 |
< |
public static <T> boolean addAll(Collection<? super T> c, T... a) { |
3519 |
> |
public static <T> boolean addAll(Collection<? super T> c, T... elements) { |
3520 |
|
boolean result = false; |
3521 |
< |
for (T e : a) |
3522 |
< |
result |= c.add(e); |
3521 |
> |
for (T element : elements) |
3522 |
> |
result |= c.add(element); |
3523 |
|
return result; |
3524 |
|
} |
3525 |
|
|
3620 |
|
private static final long serialVersionUID = 1802017725587941708L; |
3621 |
|
private final Deque<E> q; |
3622 |
|
AsLIFOQueue(Deque<E> q) { this.q = q; } |
3623 |
+ |
public boolean add(E e) { q.addFirst(e); return true; } |
3624 |
|
public boolean offer(E e) { return q.offerFirst(e); } |
3625 |
|
public E poll() { return q.pollFirst(); } |
3626 |
|
public E remove() { return q.removeFirst(); } |
3632 |
|
public Iterator<E> iterator() { return q.iterator(); } |
3633 |
|
public Object[] toArray() { return q.toArray(); } |
3634 |
|
public <T> T[] toArray(T[] a) { return q.toArray(a); } |
3628 |
– |
public boolean add(E e) { return q.offerFirst(e); } |
3635 |
|
public boolean remove(Object o) { return q.remove(o); } |
3636 |
|
public void clear() { q.clear(); } |
3637 |
|
} |