public class CompositeList<E> extends CollectionList<EventList<E>,E>
EventList
composed of multiple source EventList
s. This list shows the contents
of its source lists.
Note that all contained EventList
s must use the same ListEventPublisher
and
ReadWriteLock
, particularly if this EventList
is to be used by multiple threads
concurrently. To construct an EventList
that shares the ListEventPublisher
and
ReadWriteLock
with this CompositeList
, use createMemberList()
.
Warning: This class is thread ready but not thread
safe. See EventList
for an example of thread safe code.
EventList Overview | |
Writable: | only CollectionList.set(int,Object) and CollectionList.remove(int) |
Concurrency: | not thread safe |
Performance: | reads: O(log N), writes O(log N) |
Memory: | 96 bytes per element |
Unit Tests: | N/A |
Issues: | 25 93 96 162 |
CollectionList.Model<E,S>
source
publisher, readWriteLock, updates
Constructor and Description |
---|
CompositeList() |
CompositeList(ListEventPublisher publisher,
ReadWriteLock lock)
|
CompositeList(ReadWriteLock lock)
Deprecated.
replaced by
CompositeList(ListEventPublisher, ReadWriteLock) , because
prebuilt member lists should share lock and publisher with the
CompositeList. |
Modifier and Type | Method and Description |
---|---|
void |
addMemberList(EventList<E> member)
Adds the specified
EventList as a source to this CompositeList . |
<E> EventList<E> |
createMemberList()
Creates a new
EventList that shares its ReadWriteLock and
ListEventPublisher with this CompositeList . |
void |
removeMemberList(EventList<E> list)
|
childEndingIndex, childStartingIndex, dispose, get, isWritable, listChanged, remove, set, size
add, addAll, clear, getSourceIndex, removeAll, retainAll
add, addAll, addListEventListener, contains, containsAll, equals, getPublisher, getReadWriteLock, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeListEventListener, subList, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
replaceAll, sort, spliterator
parallelStream, removeIf, stream
public CompositeList()
@Deprecated public CompositeList(ReadWriteLock lock)
CompositeList(ListEventPublisher, ReadWriteLock)
, because
prebuilt member lists should share lock and publisher with the
CompositeList.CompositeList
that uses the given lock
. Note that this lock will
also be used when building new member lists
.
This can be a convenient constructor to use when the member lists are prebuilt ahead of time
with a common ReadWriteLock
and it is desirable to compose their union with a
CompositeList
.
lock
- the ReadWriteLock
to use within the CompositeList
public CompositeList(ListEventPublisher publisher, ReadWriteLock lock)
CompositeList
that uses the given publisher
and lock
. Note that this publisher and lock will also be used when building
new member lists
.
This can be a convenient constructor to use when the member lists are prebuilt ahead of time
with a common ListEventPublisher
and ReadWriteLock
and it is desirable to
compose their union with a CompositeList
.
publisher
- the ListEventPublisher
to use within the CompositeList
lock
- the ReadWriteLock
to use within the CompositeList
public void addMemberList(EventList<E> member)
EventList
as a source to this CompositeList
.
To ensure correct behaviour when this CompositeList
is used by multiple threads, the
specified EventList has to share the same ReadWriteLock
and ListEventPublisher
with this CompositeList.
IllegalArgumentException
- if the specified EventList uses a different
ReadWriteLock
or ListEventPublisher
createMemberList()
public <E> EventList<E> createMemberList()
EventList
that shares its ReadWriteLock
and
ListEventPublisher
with this CompositeList
. This is necessary when this
CompositeList
will be used by multiple threads.
Note that the created EventList
must be explicitly added as a member to this
CompositeList
using addMemberList(EventList)
.
Copyright © 2024 levigo holding gmbh. All rights reserved.