|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.base.glazedlists.AbstractEventList<E> com.levigo.util.base.glazedlists.BasicEventList<E>
public final class BasicEventList<E>
An 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 |
Field Summary |
---|
Fields inherited from class com.levigo.util.base.glazedlists.AbstractEventList |
---|
publisher, readWriteLock, updates |
Constructor Summary | |
---|---|
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(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)
Creates a BasicEventList using the specified
ListEventPublisher and ReadWriteLock . |
|
BasicEventList(ReadWriteLock readWriteLock)
Creates a BasicEventList that uses the specified ReadWriteLock
for concurrent access. |
Method Summary | |
---|---|
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(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,
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(Object element)
Removes the first occurrence in this list of the specified element (optional operation). |
boolean |
removeAll(Collection<?> collection)
Removes from this list all the elements that are contained in the specified collection (optional operation). |
boolean |
retainAll(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. |
Methods inherited from class com.levigo.util.base.glazedlists.AbstractEventList |
---|
addListEventListener, contains, containsAll, equals, getPublisher, getReadWriteLock, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeListEventListener, subList, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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)
BasicEventList
using the specified
ListEventPublisher
and ReadWriteLock
.
public BasicEventList(int initialCapacity, ListEventPublisher publisher, ReadWriteLock readWriteLock)
BasicEventList
using the specified initial capacity,
ListEventPublisher
and ReadWriteLock
.
@Deprecated public BasicEventList(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.
Method Detail |
---|
public void add(int index, E element)
add
in interface 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 Collection<E>
add
in interface List<E>
add
in class AbstractEventList<E>
element
- element to be appended to this list.
public boolean addAll(Collection<? extends E> collection)
addAll
in interface Collection<E>
addAll
in interface 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, Collection<? extends E> collection)
addAll
in interface 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 List<E>
remove
in class AbstractEventList<E>
index
- the index of the element to removed.
public boolean remove(Object element)
remove
in interface Collection<E>
remove
in interface List<E>
remove
in class AbstractEventList<E>
element
- element to be removed from this list, if present.
public void clear()
clear
in interface Collection<E>
clear
in interface List<E>
clear
in class AbstractEventList<E>
public E set(int index, E element)
set
in interface 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 List<E>
get
in class AbstractEventList<E>
index
- index of element to return.
public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class AbstractEventList<E>
public boolean removeAll(Collection<?> collection)
removeAll
in interface Collection<E>
removeAll
in interface 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(Collection<?> collection)
retainAll
in interface Collection<E>
retainAll
in interface List<E>
retainAll
in class AbstractEventList<E>
collection
- collection that defines which elements this set will retain.
AbstractEventList.remove(Object)
,
AbstractEventList.contains(Object)
public void dispose()
dispose
in interface EventList<E>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |