E - specifies the homogenous, concrete EMessage
type stored in this list.public final class EMessageList<E extends EMessage> extends EAbstractList<E> implements Serializable, Cloneable
message field type allows multiple
messages to be transported within another
eBus message. A message list is message key
homogenous. That is, a message list takes an eBus message key
parameter and uses that key to verify that all messages placed
in this list have the same key as the parameter. That also
means that null messages may not be added to a
message list.
The difference between EMessageList and
EMessage[] is that EMessageList serializes
the defining EMessageKey once and then each message
instance in turn. This works because EMessageList
items all use the same message key. EMessage[] allows
messages with different message keys, so the message key is
serialized for each message item. This greatly increases the
serialization/de-serialization time and serialized buffer
size.
This class extends ArrayList, providing all the
features available in that class.
There is no limit as to the number of elements which may be
placed into this list. But care must be taken not to overflow
the eBus ByteBuffer when serializing for transport.
mReadOnlyFlagmodCount| Constructor and Description |
|---|
EMessageList(Collection<E> c,
EMessageKey key)
Creates a message list instance containing the same
elements as
c and in the order returned by the
collection's iterator. |
EMessageList(EMessageKey key)
Creates an empty message list instance with an initial
capacity of ten.
|
EMessageList(int initialCapacity,
EMessageKey key)
Creates an empty message list instance 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(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,
Collection<? extends E> c)
Inserts all of the elements in the specified collection
into this list, starting at the specified position.
|
EMessageKey |
key()
Returns the list element message key.
|
E |
set(int index,
E e)
Replaces the element at the specified position in this
list with the specified element.
|
clear, isReadOnly, iterator, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, setReadOnly, sort, subListclone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, lastIndexOf, size, spliterator, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic EMessageList(EMessageKey key) throws NullPointerException
key - list elements must be
eBus messages containing this message key.NullPointerException - if key is null.public EMessageList(int initialCapacity,
EMessageKey key)
throws NullPointerException
initialCapacity - the list initial capacity.key - list elements must be
eBus messages containing this message key.NullPointerException - if key is null.public EMessageList(Collection<E> c, EMessageKey key) throws NullPointerException, IllegalArgumentException
c and in the order returned by the
collection's iterator.c - place this collection's elements into this
message list.key - list elements must be
eBus messages containing this message key.NullPointerException - if either c or key is null.IllegalArgumentException - if c contains a message with a key that does not
equal key.public boolean add(E e) throws NullPointerException, IllegalArgumentException, UnsupportedOperationException
add in interface Collection<E extends EMessage>add in interface List<E extends EMessage>add in class EAbstractList<E extends EMessage>e - append this element to list.true (as specified by
Collection.add(E)).NullPointerException - if e is null.IllegalArgumentException - if e does not have a correct message key which
matches this list's key.UnsupportedOperationException - if this list is marked as read-only.public void add(int index,
E e)
throws NullPointerException,
IllegalArgumentException,
IndexOutOfBoundsException
add in interface List<E extends EMessage>add in class EAbstractList<E extends EMessage>index - insert e into list at this index.e - insert this element into list.NullPointerException - if e is null.IllegalArgumentException - if e does not have a correct message key which
matches this list's key.IndexOutOfBoundsException - if index is out of range
(index < 0 || index > this.size()).UnsupportedOperationException - if this list is marked as read-only.public boolean addAll(Collection<? extends E> c) throws NullPointerException, IllegalArgumentException, UnsupportedOperationException
addAll in interface Collection<E extends EMessage>addAll in interface List<E extends EMessage>addAll in class EAbstractList<E extends EMessage>c - append the elements of c to this list.true if this list changed as a result of
the call.NullPointerException - if c is null.IllegalArgumentException - if c contains elements that are either
null or messages that have message keys that do
not match this list's message key.UnsupportedOperationException - if this list is marked as read-only.public boolean addAll(int index,
Collection<? extends E> c)
throws NullPointerException,
IllegalArgumentException,
IndexOutOfBoundsException,
UnsupportedOperationException
addAll in interface List<E extends EMessage>addAll in class EAbstractList<E extends EMessage>index - insert c's elements into this list
at this index.c - collection containing insertion elements.true if this list changed as a result of
the call.NullPointerException - if c is null.IllegalArgumentException - if c contains elements that are either
null or messages that have message keys that do
not match this list's message key.IndexOutOfBoundsException - if index is out of range
(index < 0 || index > this.size()).UnsupportedOperationException - if this list is marked as read-only.public E set(int index, E e) throws NullPointerException, IllegalArgumentException, IndexOutOfBoundsException, UnsupportedOperationException
set in interface List<E extends EMessage>set in class EAbstractList<E extends EMessage>index - replace element at this index.e - put this element at specified index.NullPointerException - if e is null.IllegalArgumentException - if e does not have a correct message key which
matches this list's key.IndexOutOfBoundsException - if index is out of range
(index < 0 || index > this.size()).UnsupportedOperationException - if this list is marked as read-only.public EMessageKey key()
Copyright © 2019. All rights reserved.