public final class CopyList<E> extends AbstractList<E> implements RandomAccess, Cloneable
Modifier and Type | Class and Description |
---|---|
private class |
CopyList.Itr |
Modifier and Type | Field and Description |
---|---|
private E[] |
array |
private boolean |
pristine |
private int |
size |
modCount
Constructor and Description |
---|
CopyList(E[] array)
Create a List over given array.
|
CopyList(E[] array,
int size) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element) |
void |
add(int index,
E element) |
private void |
changeCheck() |
void |
clear() |
Object |
clone()
Returns another independent copy-on-write copy of this List
instance.
|
private void |
ensureCapacity(int target) |
E |
get(int index) |
Iterator<E> |
iterator() |
private void |
rangeCheck(int index) |
E |
remove(int index) |
E |
set(int index,
E element) |
int |
size() |
addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
public CopyList(E[] array)
array
- The initial List content. The array is never modified
by the CopyList
.public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class AbstractCollection<E>
public boolean add(E element)
add
in interface Collection<E>
add
in interface List<E>
add
in class AbstractList<E>
public void clear()
clear
in interface Collection<E>
clear
in interface List<E>
clear
in class AbstractList<E>
public Object clone()
private void rangeCheck(int index)
private void changeCheck()
private void ensureCapacity(int target)