|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.objectplanet.survey.event.ListenerArrayList
A wrapper for ArrayList that provides synchronized access, with high performance toArray(). The list is tailor made for listener lists. The first get method call after a set() or add() call will have poor performance, because an array will be copied from the arrayList. When looping through the list, it is recommended to use toArray[]. This is very fast, since it will use a pre-created array (which is a copy of the list). This will not be affected by changes in the ArrayList while looping through it, because it is a copy of the ArrayList. This class only has a small subset of the methods in java.util.Arraylist
| Constructor Summary | |
ListenerArrayList()
Creates an empty SynchronizedArrayList, with default capacity as in java.util.ArrayList |
|
| Method Summary | |
void |
add(int index,
java.lang.Object object)
Adds an element at the specified position in the list |
void |
add(java.lang.Object object)
Adds an element at the end of the list |
void |
ensureListSize(int size)
Make sure the list is at least the specified size. |
java.lang.Object |
get(int index)
Gets an object in the list, at the specified position |
void |
remove(java.lang.Object object)
Removes an item from the list |
void |
set(int index,
java.lang.Object object)
Set an element in the list at the specified index. |
int |
size()
Gets the size of the list |
void |
sort()
Sorts the arraylist. |
IEventListener[] |
toArray()
Gets an array with all objects in the list. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ListenerArrayList()
| Method Detail |
public java.lang.Object get(int index)
index - The position of the object to retrieve
public void add(java.lang.Object object)
object - The element to add
public void add(int index,
java.lang.Object object)
object - The element to add
public void set(int index,
java.lang.Object object)
index - The position of the object to setobject - The object to set at the specified positionpublic int size()
public IEventListener[] toArray()
public void ensureListSize(int size)
size - The list will be set to this size if it is not at least this size already.public void remove(java.lang.Object object)
object - The object to removepublic void sort()
|
Copyright © ObjectPlanet Inc. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||