nsIArray
Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)Consumers of nsIArray
should not QueryInterface
to nsIMutableArray
unless they own the array.
As above, it is legal to add null
elements to the array. Note also that null
elements can be created as a side effect of insertElementAt()
. Conversely, if insertElementAt()
is never used, and null
elements are never explicitly added to the array, then it is guaranteed that nsIArray.queryElementAt()
will never return a null
value.
Any of these methods may throw NS_ERROR_OUT_OF_MEMORY when the array must grow to complete the call, but the allocation fails.
void appendElement(in nsISupports element, in boolean weak); |
void clear(); |
void insertElementAt(in nsISupports element, in unsigned long index, in boolean weak); |
void removeElementAt(in unsigned long index); |
void replaceElementAt(in nsISupports element, in unsigned long index, in boolean weak); |
Append an element at the end of the array.
void appendElement( in nsISupports element, in boolean weak );
element
weak
NS_ERROR_FAILURE
nsIWeakReference
.Clear the entire array, releasing all stored objects.
void clear();
None.
Insert an element at the given position, moving the element currently located in that position, and all elements in higher position, up by one.
void insertElementAt( in nsISupports element, in unsigned long index, in boolean weak );
element
index
weak
NS_ERROR_FAILURE
nsIWeakReference
.Remove an element at a specific position, moving all elements stored at a higher position down one. To remove a specific element, use nsIArray.indexOf()
to find the index first, then call removeElementAt
.
void removeElementAt( in unsigned long index );
index
Replace the element at the given position.
void replaceElementAt( in nsISupports element, in unsigned long index, in boolean weak );
element
index
weak
NS_ERROR_FAILURE
nsIWeakReference
.