public class ListenableArrayList<E> extends java.util.ArrayList<E> implements ListenableCollection<E>
| Constructor and Description |
|---|
ListenableArrayList() |
ListenableArrayList(java.util.Collection<? extends E> collection)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.
|
ListenableArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Appends the specified element to the end of this list.
|
void |
add(int index, E e)
Inserts the specified element at the specified position in this list.
|
boolean |
addAll(java.util.Collection<? extends E> c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.
|
boolean |
addAll(int index, java.util.Collection<? extends E> c)
Inserts all of the elements in the specified collection into this list, starting at the specified position.
|
void |
addListener(CollectionListener<E> listener)
Add a listener to be notified when the list changes.
|
void |
clear()
Removes all of the elements from this list.
|
protected java.util.List<CollectionListener<E>> |
createListenerList()
Create a list to hold the registered listeners.
|
protected void |
fireChange(CollectionEvent.Type type, E element, int index) |
E |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
remove(java.lang.Object o)
Removes the first occurrence of the specified element from this list, if it is present.
|
boolean |
removeAll(java.util.Collection<?> c) |
void |
removeListener(CollectionListener<E> listener)
Stop listening for changes to the collection.
|
protected void |
removeRange(int fromIndex, int toIndex)
Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.
|
boolean |
retainAll(java.util.Collection<?> c) |
clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, set, size, subList, toArray, toArray, trimToSizefinalize, getClass, notify, notifyAll, wait, wait, waitpublic ListenableArrayList(java.util.Collection<? extends E> collection)
collection - the collection whose elements are to be placed into this listjava.lang.NullPointerException - if the specified collection is nullpublic ListenableArrayList()
public ListenableArrayList(int initialCapacity)
initialCapacity - the initial capacity of the listjava.lang.IllegalArgumentException - if the specified initial capacity is negativeprotected java.util.List<CollectionListener<E>> createListenerList()
public void addListener(CollectionListener<E> listener)
addListener in interface ListenableCollection<E>listener -public void removeListener(CollectionListener<E> listener)
ListenableCollectionremoveListener in interface ListenableCollection<E>public boolean add(E e)
public void add(int index,
E e)
public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>addAll in interface java.util.List<E>addAll in class java.util.ArrayList<E>c - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified collection is null
public boolean addAll(int index,
java.util.Collection<? extends E> c)
addAll in interface java.util.List<E>addAll in class java.util.ArrayList<E>index - index at which to insert the first element from the specified collectionc - collection containing elements to be added to this listjava.lang.IndexOutOfBoundsExceptionjava.lang.NullPointerException - if the specified collection is nullpublic void clear()
public E remove(int index)
public boolean remove(java.lang.Object o)
protected void removeRange(int fromIndex,
int toIndex)
removeRange in class java.util.ArrayList<E>fromIndex - index of first element to be removedtoIndex - index after last element to be removedjava.lang.IndexOutOfBoundsException - if fromIndex or toIndex out of range (fromIndex < 0 || fromIndex >= size() || toIndex > size() || toIndex < fromIndex)protected void fireChange(CollectionEvent.Type type, E element, int index)
public boolean removeAll(java.util.Collection<?> c)
This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements in common with the specified collection.
removeAll in interface java.util.Collection<E>removeAll in interface java.util.List<E>removeAll in class java.util.ArrayList<E>java.lang.UnsupportedOperationExceptionjava.lang.ClassCastExceptionjava.lang.NullPointerExceptionremove(Object), ArrayList.contains(Object)public boolean retainAll(java.util.Collection<?> c)
This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's not so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements not present in the specified collection.
retainAll in interface java.util.Collection<E>retainAll in interface java.util.List<E>retainAll in class java.util.ArrayList<E>java.lang.UnsupportedOperationExceptionjava.lang.ClassCastExceptionjava.lang.NullPointerExceptionremove(Object), ArrayList.contains(Object)