public class CachedArrayList<E> extends ArrayList<E>
Just
like ArrayList, this implementation is not synchronized. If you want a thread safe implementation, you can
use CachedVector
.
Modifier and Type | Class and Description |
---|---|
static class |
CachedArrayList.IntegerWrapper |
modCount
Constructor and Description |
---|
CachedArrayList() |
CachedArrayList(Collection<? extends E> c) |
CachedArrayList(int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o) |
void |
add(int index,
E element) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
protected void |
adjustCache(int index,
int increase)
Deprecated.
no longer being invoked since 3.4.0
|
void |
cacheAll()
Cache all the element index.
|
void |
cacheIt(Object o,
int index)
Caches the index of the element.
|
void |
clear() |
protected Map<Object,CachedArrayList.IntegerWrapper> |
createCache() |
int |
indexOf(Object elem) |
void |
invalidateCache()
Invalidated the whole cache.
|
boolean |
isLazyCaching() |
protected void |
markDirtyIfNecessary(int index)
Marks the entire cache dirty if necessary depends on where the index is.
|
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.
|
clone, contains, ensureCapacity, get, isEmpty, iterator, lastIndexOf, listIterator, listIterator, retainAll, size, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode
public CachedArrayList()
public CachedArrayList(Collection<? extends E> c)
public CachedArrayList(int initialCapacity)
public int indexOf(Object elem)
@Deprecated 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,CachedArrayList.IntegerWrapper> createCache()
public void cacheIt(Object o, int index)
o
- the elementindex
- the index.protected void markDirtyIfNecessary(int index)
index
- the index that is changing.public void uncacheIt(Object o)
o
- the elementpublic boolean add(E o)
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 ArrayList<E>