|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.avalon.fortress.util.LifecycleExtensionManager.CachedArrayList
CachedArrayList class.
This class wraps a synchronized ArrayList to provide an optimized toArray() method that returns an internally cached array, rather than a new array generated per toArray() invocation.
Use of the class by the Manager results in toArray() being invoked far more often than any other method. Caching the value toArray normally returns is intended to be a performance optimization.
The cached array value is updated upon each write operation to the List.
REVISIT(MC): investigate using FastArrayList from collections ?
| Field Summary | |
private java.lang.Object[] |
EMPTY_ARRAY |
private java.lang.Object[] |
m_cache |
private java.util.List |
m_proxy |
| Constructor Summary | |
private |
LifecycleExtensionManager.CachedArrayList() |
| Method Summary | |
void |
add(java.lang.Object object)Add an object to the list |
void |
clear()Clear the list |
void |
copyFrom(LifecycleExtensionManager.CachedArrayList original)Become a copy of another CachedArrayList. |
java.lang.Object |
get(int index)Access an object that is in the list |
int |
indexOf(java.lang.Object object)Find out the index of an object in the list |
void |
insert(int position, java.lang.Object object)Insert an object into a particular position in the list |
java.util.Iterator |
iterator()Obtain an iterator. |
java.lang.Object |
remove(int position)Remove an object from the list |
int |
size()Obtain the size of the list |
java.lang.Object[] |
toArray()Obtain the list as an array. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private final java.lang.Object[] EMPTY_ARRAY
private final java.util.List m_proxy
private java.lang.Object[] m_cache
| Constructor Detail |
private LifecycleExtensionManager.CachedArrayList()
| Method Detail |
public void copyFrom(LifecycleExtensionManager.CachedArrayList original)
public void add(java.lang.Object object)
object - an Object value
public void insert(int position,
java.lang.Object object)
position - an int valueobject - an Object valuepublic java.lang.Object remove(int position)
position - an int valueObject valuepublic java.util.Iterator iterator()
Iterator valuepublic int size()
int valuepublic java.lang.Object get(int index)
index - an int valueObject valuepublic int indexOf(java.lang.Object object)
object - an Object valueint valuepublic void clear()
public java.lang.Object[] toArray()
Object[] value
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||