public final class BasicEventList<E> extends AbstractEventList<E> implements java.io.Serializable, java.util.RandomAccess
EventList
that wraps any simple List
, such as ArrayList
or LinkedList
.
Unlike most EventList
s, this class is Serializable
. When
BasicEventList
is serialized, all of its elements are serialized
and all of its listeners that implement Serializable
. Upon
deserialization, the new copy uses a different lock
than its source BasicEventList
.
EventList Overview | |
Writable: | yes |
Concurrency: | thread ready, not thread safe |
Performance: | reads: O(1), writes O(1) amortized |
Memory: | O(N) |
Unit Tests: | N/A |
Issues: | N/A |
publisher, readWriteLock, updates
Constructor and Description |
---|
BasicEventList()
Creates a
BasicEventList . |
BasicEventList(int initalCapacity)
Creates an empty
BasicEventList with the given
initialCapacity . |
BasicEventList(int initialCapacity,
ListEventPublisher publisher,
ReadWriteLock readWriteLock)
Creates a
BasicEventList using the specified initial capacity,
ListEventPublisher and ReadWriteLock . |
BasicEventList(java.util.List<E> list)
Deprecated.
As of 2005/03/06, this constructor has been declared unsafe
because the source list is exposed. This allows it to be modified without
the required events being fired. This constructor has been replaced by
the factory method
GlazedLists.eventList(Collection) . |
BasicEventList(ListEventPublisher publisher,
ReadWriteLock readWriteLock)
|
BasicEventList(ReadWriteLock readWriteLock)
Creates a
BasicEventList that uses the specified ReadWriteLock
for concurrent access. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element)
Appends the specified element to the end of this list (optional
operation).
|
void |
add(int index,
E element)
Inserts the specified element at the specified position in this list
(optional operation).
|
boolean |
addAll(java.util.Collection<? extends E> collection)
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 (optional operation).
|
boolean |
addAll(int index,
java.util.Collection<? extends E> collection)
Inserts all of the elements in the specified collection into this
list at the specified position (optional operation).
|
void |
clear()
Removes all of the elements from this list (optional operation).
|
void |
dispose()
This method does nothing.
|
E |
get(int index)
Returns the element at the specified position in this list.
|
E |
remove(int index)
Removes the element at the specified position in this list (optional
operation).
|
boolean |
remove(java.lang.Object element)
Removes the first occurrence in this list of the specified element
(optional operation).
|
boolean |
removeAll(java.util.Collection<?> collection)
Removes from this list all the elements that are contained in the
specified collection (optional operation).
|
boolean |
retainAll(java.util.Collection<?> collection)
Retains only the elements in this list that are contained in the
specified collection (optional operation).
|
E |
set(int index,
E element)
Replaces the element at the specified position in this list with the
specified element (optional operation).
|
int |
size()
Returns the number of elements in this list.
|
addListEventListener, contains, containsAll, equals, getPublisher, getReadWriteLock, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeListEventListener, subList, toArray, toArray, toString
public BasicEventList()
BasicEventList
.public BasicEventList(ReadWriteLock readWriteLock)
BasicEventList
that uses the specified ReadWriteLock
for concurrent access.public BasicEventList(int initalCapacity)
BasicEventList
with the given
initialCapacity
.public BasicEventList(ListEventPublisher publisher, ReadWriteLock readWriteLock)
public BasicEventList(int initialCapacity, ListEventPublisher publisher, ReadWriteLock readWriteLock)
BasicEventList
using the specified initial capacity,
ListEventPublisher
and ReadWriteLock
.public BasicEventList(java.util.List<E> list)
GlazedLists.eventList(Collection)
.BasicEventList
that uses the specified List
as
the underlying implementation.
Warning: all editing to
the specified List
must be done through via this
BasicEventList
interface. Otherwise this BasicEventList
will
become out of sync and operations will fail.
public void add(int index, E element)
add
in interface java.util.List<E>
add
in class AbstractEventList<E>
index
- index at which the specified element is to be inserted.element
- element to be inserted.public boolean add(E element)
Lists that support this operation may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. List classes should clearly specify in their documentation any restrictions on what elements may be added.
add
in interface java.util.Collection<E>
add
in interface java.util.List<E>
add
in class AbstractEventList<E>
element
- element to be appended to this list.public boolean addAll(java.util.Collection<? extends E> collection)
addAll
in interface java.util.Collection<E>
addAll
in interface java.util.List<E>
addAll
in class AbstractEventList<E>
collection
- collection whose elements are to be added to this list.AbstractEventList.add(Object)
public boolean addAll(int index, java.util.Collection<? extends E> collection)
addAll
in interface java.util.List<E>
addAll
in class AbstractEventList<E>
index
- index at which to insert first element from the specified
collection.collection
- elements to be inserted into this list.public E remove(int index)
remove
in interface java.util.List<E>
remove
in class AbstractEventList<E>
index
- the index of the element to removed.public boolean remove(java.lang.Object element)
remove
in interface java.util.Collection<E>
remove
in interface java.util.List<E>
remove
in class AbstractEventList<E>
element
- element to be removed from this list, if present.public void clear()
clear
in interface java.util.Collection<E>
clear
in interface java.util.List<E>
clear
in class AbstractEventList<E>
public E set(int index, E element)
set
in interface java.util.List<E>
set
in class AbstractEventList<E>
index
- index of element to replace.element
- element to be stored at the specified position.public E get(int index)
get
in interface java.util.List<E>
get
in class AbstractEventList<E>
index
- index of element to return.public int size()
size
in interface java.util.Collection<E>
size
in interface java.util.List<E>
size
in class AbstractEventList<E>
public boolean removeAll(java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<E>
removeAll
in interface java.util.List<E>
removeAll
in class AbstractEventList<E>
collection
- collection that defines which elements will be removed from
this list.AbstractEventList.remove(Object)
,
AbstractEventList.contains(Object)
public boolean retainAll(java.util.Collection<?> collection)
retainAll
in interface java.util.Collection<E>
retainAll
in interface java.util.List<E>
retainAll
in class AbstractEventList<E>
collection
- collection that defines which elements this set will retain.AbstractEventList.remove(Object)
,
AbstractEventList.contains(Object)
Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by mockbuild at 2012-03-02 14:06