public class CachedArrayList<E>
extends java.util.ArrayList<E>
Just
like ArrayList, this implementation is not synchronized. If you want a thread safe implementation, you can
use CachedArrayList
.
Modifier and Type | Class | Description |
---|---|---|
static class |
CachedArrayList.IntegerWrapper |
Constructor | Description |
---|---|
CachedArrayList() |
|
CachedArrayList(int initialCapacity) |
|
CachedArrayList(java.util.Collection<? extends E> c) |
Modifier and Type | Method | Description |
---|---|---|
void |
add(int index,
E element) |
|
boolean |
add(E element) |
|
boolean |
addAll(int index,
java.util.Collection<? extends E> c) |
|
boolean |
addAll(java.util.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(java.lang.Object o,
int index) |
Caches the index of the element.
|
void |
clear() |
|
protected java.util.Map<java.lang.Object,CachedArrayList.IntegerWrapper> |
createCache() |
|
int |
indexOf(java.lang.Object elem) |
|
void |
invalidateCache() |
Invalidated the whole cache.
|
boolean |
isLazyCaching() |
|
E |
remove(int index) |
|
boolean |
remove(java.lang.Object o) |
|
boolean |
removeAll(java.util.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(java.lang.Object o) |
Uncaches the index of the element.
|
clone, contains, ensureCapacity, forEach, get, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeIf, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
public CachedArrayList()
public CachedArrayList(java.util.Collection<? extends E> c)
public CachedArrayList(int initialCapacity)
public int indexOf(java.lang.Object elem)
indexOf
in class java.util.ArrayList<E>
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 java.util.Map<java.lang.Object,CachedArrayList.IntegerWrapper> createCache()
public void cacheIt(java.lang.Object o, int index)
o
- the elementindex
- the index.public void uncacheIt(java.lang.Object o)
o
- the elementpublic boolean remove(java.lang.Object o)
remove
in class java.util.ArrayList<E>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in class java.util.ArrayList<E>
public void clear()
clear
in class java.util.ArrayList<E>
public boolean addAll(java.util.Collection<? extends E> c)
addAll
in class java.util.ArrayList<E>
public boolean addAll(int index, java.util.Collection<? extends E> c)
addAll
in class java.util.ArrayList<E>
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 java.util.ArrayList<E>