public class COWList
extends java.lang.Object
implements java.util.List
| Modifier and Type | Class and Description |
|---|---|
static class |
COWList.TYPE |
| Constructor and Description |
|---|
COWList(java.util.BitSet elementData,
int startIdx,
int length)
Wrap a BitSet into a Copy On Write SubList
|
COWList(double[] elementData,
int startIdx,
int length)
Wrap an array of double (primitive) into a Copy On Write SubList
|
COWList(long[] elementData,
int startIdx,
int length)
Wrap an array of long (primitive) into a Copy On Write SubList
|
COWList(java.lang.String[] elementData,
int startIdx,
int length)
Wrap an array of String into a Copy On Write SubList
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
java.lang.Object element)
Modification of the underlying array or bitset is forbidden.
|
boolean |
add(java.lang.Object o)
Modification of the underlying array or bitset is forbidden.
|
boolean |
addAll(java.util.Collection c)
Modification of the underlying array or bitset is forbidden.
|
boolean |
addAll(int index,
java.util.Collection c)
Modification of the underlying array or bitset is forbidden.
|
void |
clear()
Modification of the underlying array or bitset is forbidden.
|
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection c) |
java.lang.Object |
get(int index)
If not altered, get will return the element at index + startidx of the underlying array or bitset.
|
COWList.TYPE |
getDataType()
getDataType is only valid when the list has not been altered.
|
int |
indexOf(java.lang.Object o) |
boolean |
isEmpty() |
boolean |
isReadOnly() |
java.util.Iterator |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator |
listIterator() |
java.util.ListIterator |
listIterator(int index) |
java.lang.Object |
remove(int index)
Modification of the underlying array or bitset is forbidden.
|
boolean |
remove(java.lang.Object o)
Modification of the underlying array or bitset is forbidden.
|
boolean |
removeAll(java.util.Collection c) |
void |
replaceAll(java.util.function.UnaryOperator operator)
Modification of the underlying array or bitset is forbidden.
|
boolean |
retainAll(java.util.Collection c) |
java.lang.Object |
set(int index,
java.lang.Object element)
Modification of the underlying array or bitset is forbidden.
|
int |
size() |
void |
sort(java.util.Comparator c)
Modification of the underlying array or bitset is forbidden.
|
java.util.List |
subList(int fromIndex,
int toIndex)
When non altered, returns a new copy on write subList from existing one, backed by the original array.
|
java.lang.Object[] |
toArray()
creates a new long/double/String/boolean array from the current subList (deep copy).
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
creates a new long/double/String/boolean/Object array from the current subList (deep copy).
|
public COWList(long[] elementData,
int startIdx,
int length)
elementData - array of longstartIdx - index of the first elementlength - length of the subList. startidx+length cannot exceed elementData.lengthpublic COWList(double[] elementData,
int startIdx,
int length)
elementData - array of doublestartIdx - index of the first elementlength - length of the subList. startidx+length cannot exceed elementData.lengthpublic COWList(java.util.BitSet elementData,
int startIdx,
int length)
elementData - BitSetstartIdx - index of the first elementlength - length of the subList. startidx+length cannot exceed BitSet sizepublic COWList(java.lang.String[] elementData,
int startIdx,
int length)
elementData - array of StringstartIdx - index of the first elementlength - length of the subList. startidx+length cannot exceed elementData.lengthpublic COWList.TYPE getDataType()
public boolean isReadOnly()
public int indexOf(java.lang.Object o)
indexOf in interface java.util.Listpublic int size()
size in interface java.util.Collectionsize in interface java.util.Listpublic boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Listpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Listpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Listpublic boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Listpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Listpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.CollectionaddAll in interface java.util.Listpublic boolean addAll(int index,
java.util.Collection c)
addAll in interface java.util.Listpublic void replaceAll(java.util.function.UnaryOperator operator)
replaceAll in interface java.util.Listpublic void sort(java.util.Comparator c)
sort in interface java.util.Listpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Listpublic java.lang.Object get(int index)
get in interface java.util.Listindex - cannot be less than 0 or greater than list lengthpublic java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.Listpublic void add(int index,
java.lang.Object element)
add in interface java.util.Listpublic java.lang.Object remove(int index)
remove in interface java.util.Listpublic int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.Listpublic java.util.ListIterator listIterator()
listIterator in interface java.util.Listpublic java.util.ListIterator listIterator(int index)
listIterator in interface java.util.Listpublic java.util.List subList(int fromIndex,
int toIndex)
fromIndex, inclusive, and toIndex, exclusive. (If
fromIndex and toIndex are equal, the returned list is
empty.)subList in interface java.util.Listpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.Listpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Listpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Listpublic java.lang.Object[] toArray(java.lang.Object[] a)
a is not big enough, toArray allocates and returns a new arraytoArray in interface java.util.CollectiontoArray in interface java.util.Listpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.List