public final class BasicEventList<E> extends AbstractEventList<E> implements Serializable, 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(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(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.
|
addListEventListener, contains, containsAll, equals, getPublisher, getReadWriteLock, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeListEventListener, subList, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
replaceAll, sort, spliterator
parallelStream, removeIf, stream
public BasicEventList()
BasicEventList
.public BasicEventList(ReadWriteLock readWriteLock)
BasicEventList
that uses the specified ReadWriteLock
for concurrent access.readWriteLock
- See BasicEventList(ListEventPublisher, ReadWriteLock)
public BasicEventList(int initalCapacity)
BasicEventList
with the given initialCapacity
.initalCapacity
- See BasicEventList(int, ListEventPublisher, ReadWriteLock)
public BasicEventList(ListEventPublisher publisher, ReadWriteLock readWriteLock)
publisher
- See BasicEventList(int, ListEventPublisher, ReadWriteLock)
readWriteLock
- See BasicEventList(int, ListEventPublisher, ReadWriteLock)
public BasicEventList(int initialCapacity, ListEventPublisher publisher, ReadWriteLock readWriteLock)
BasicEventList
using the specified initial capacity, ListEventPublisher
and
ReadWriteLock
.initialCapacity
- the initial backing capacity of the list.publisher
- See AbstractEventList(ListEventPublisher)
readWriteLock
- If null
LockFactory.DEFAULT
is used to create one.@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.
list
- The list to wrap.public void add(int index, E element)
public boolean add(E element)
AbstractEventList
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.true
(as per the general contract of the Collection.add
method).public boolean addAll(Collection<? extends E> collection)
AbstractEventList
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.true
if this list changed as a result of the call.AbstractEventList.add(Object)
public boolean addAll(int index, Collection<? extends E> collection)
AbstractEventList
public E remove(int index)
public boolean remove(Object element)
(o==null ? get(i)==null : o.equals(get(i)))
(if such
an element exists).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.true
if this list contained the specified element.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)
public E get(int index)
public int size()
Integer.MAX_VALUE
elements, returns Integer.MAX_VALUE
.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.true
if this list changed as a result of the call.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.true
if this list changed as a result of the call.AbstractEventList.remove(Object)
,
AbstractEventList.contains(Object)
Copyright © 2024 levigo holding gmbh. All rights reserved.