69 |
|
* iterator. |
70 |
|
* @param c the collection of initially held elements |
71 |
|
*/ |
72 |
< |
public CopyOnWriteArrayList(Collection<E> c) { |
72 |
> |
public CopyOnWriteArrayList(Collection<? extends E> c) { |
73 |
|
array = (E[]) new Object[c.size()]; |
74 |
< |
Iterator<E> i = c.iterator(); |
74 |
> |
Iterator<? extends E> i = c.iterator(); |
75 |
|
int size = 0; |
76 |
|
while (i.hasNext()) |
77 |
|
array[size++] = i.next(); |
129 |
|
* |
130 |
|
* @param elem element whose presence in this List is to be tested. |
131 |
|
* @return <code>true</code> if the specified element is present; |
132 |
< |
* <code>false</code> otherwise. |
132 |
> |
* <code>false</code> otherwise. |
133 |
|
*/ |
134 |
|
public boolean contains(Object elem) { |
135 |
|
E[] elementData = array(); |
272 |
|
* Returns an array containing all of the elements in this list |
273 |
|
* in the correct order. |
274 |
|
* @return an array containing all of the elements in this list |
275 |
< |
* in the correct order. |
275 |
> |
* in the correct order. |
276 |
|
*/ |
277 |
|
public Object[] toArray() { |
278 |
|
Object[] elementData = array(); |
326 |
|
* @param index index of element to return. |
327 |
|
* @return the element at the specified position in this list. |
328 |
|
* @throws IndexOutOfBoundsException if index is out of range <tt>(index |
329 |
< |
* < 0 || index >= size())</tt>. |
329 |
> |
* < 0 || index >= size())</tt>. |
330 |
|
*/ |
331 |
|
public E get(int index) { |
332 |
|
E[] elementData = array(); |
342 |
|
* @param element element to be stored at the specified position. |
343 |
|
* @return the element previously at the specified position. |
344 |
|
* @throws IndexOutOfBoundsException if index out of range |
345 |
< |
* <tt>(index < 0 || index >= size())</tt>. |
345 |
> |
* <tt>(index < 0 || index >= size())</tt>. |
346 |
|
*/ |
347 |
|
public synchronized E set(int index, E element) { |
348 |
|
int len = array.length; |
383 |
|
* @param index index at which the specified element is to be inserted. |
384 |
|
* @param element element to be inserted. |
385 |
|
* @throws IndexOutOfBoundsException if index is out of range |
386 |
< |
* <tt>(index < 0 || index > size())</tt>. |
386 |
> |
* <tt>(index < 0 || index > size())</tt>. |
387 |
|
*/ |
388 |
|
public synchronized void add(int index, E element) { |
389 |
|
int len = array.length; |
405 |
|
* @param index the index of the element to removed. |
406 |
|
* @return the element that was removed from the list. |
407 |
|
* @throws IndexOutOfBoundsException if index out of range <tt>(index |
408 |
< |
* < 0 || index >= size())</tt>. |
408 |
> |
* < 0 || index >= size())</tt>. |
409 |
|
*/ |
410 |
|
public synchronized E remove(int index) { |
411 |
|
int len = array.length; |