Serializable
, Cloneable
, Iterable<E>
, Collection<E>
, List<E>
, RandomAccess
public class CachedVector<E> extends Vector<E>
Just like
Vector, this implementation is synchronized. In comparison, CachedArrayList
is not synchronized.
Modifier and Type | Class | Description |
---|---|---|
static class |
CachedVector.IntegerWrapper |
modCount
capacityIncrement, elementCount, elementData
Constructor | Description |
---|---|
CachedVector() |
|
CachedVector(int initialCapacity) |
|
CachedVector(Collection<? extends E> c) |
Modifier and Type | Method | Description |
---|---|---|
void |
add(int index,
E element) |
|
boolean |
add(E element) |
|
boolean |
addAll(int index,
Collection<? extends E> c) |
|
boolean |
addAll(Collection<? extends E> c) |
|
protected void |
adjustCache(int index,
int increase) |
Adjusts the cache so that all values that are greater than index will increase by the value specified by the
increase parameter.
|
void |
cacheAll() |
Cache all the element index.
|
void |
cacheIt(Object o,
int index) |
Caches the index of the element.
|
void |
clear() |
|
protected Map<Object,CachedVector.IntegerWrapper> |
createCache() |
|
int |
indexOf(Object elem) |
|
void |
invalidateCache() |
Invalidated the whole cache.
|
boolean |
isLazyCaching() |
|
E |
remove(int index) |
|
boolean |
remove(Object o) |
|
boolean |
removeAll(Collection<?> c) |
|
protected void |
removeRange(int fromIndex,
int toIndex) |
|
E |
set(int index,
E element) |
|
void |
setLazyCaching(boolean lazyCaching) |
|
void |
uncacheAll() |
Uncache the whole cache.
|
void |
uncacheIt(Object o) |
Uncaches the index of the element.
|
parallelStream, stream
finalize, getClass, notify, notifyAll, wait, wait, wait
addElement, capacity, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, removeAllElements, removeElement, removeElementAt, removeIf, replaceAll, retainAll, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
public CachedVector()
public CachedVector(Collection<? extends E> c)
public CachedVector(int initialCapacity)
public int indexOf(Object elem)
protected void adjustCache(int index, int increase)
index
- the index. All values above this index will be changed.increase
- a positive number to increase or a negative number to decrease.protected Map<Object,CachedVector.IntegerWrapper> createCache()
public void cacheIt(Object o, int index)
o
- the elementindex
- the index.public void uncacheIt(Object o)
o
- the elementpublic boolean add(E element)
public void add(int index, E element)
public E remove(int index)
public boolean remove(Object o)
public boolean removeAll(Collection<?> c)
public void clear()
public boolean addAll(Collection<? extends E> c)
public boolean addAll(int index, Collection<? extends E> c)
public void invalidateCache()
public void uncacheAll()
invalidateCache()
.public void cacheAll()
public boolean isLazyCaching()
public void setLazyCaching(boolean lazyCaching)
protected void removeRange(int fromIndex, int toIndex)
removeRange
in class Vector<E>