public final class CopyList<E> extends java.util.AbstractList<E> implements java.util.RandomAccess, java.lang.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 |
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() |
java.lang.Object |
clone()
Returns another independent copy-on-write copy of this List
instance.
|
private void |
ensureCapacity(int target) |
E |
get(int index) |
java.util.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()
public void clear()
public java.lang.Object clone()
clone
in class java.lang.Object
private void rangeCheck(int index)
private void changeCheck()
private void ensureCapacity(int target)