public interface ILcdList<T> extends ILcdCollection<T>, List<T>
An extension of the Java List
which fires an TLcdCollectionEvent
and TLcdListEvent
for every element that is added to or removed from the list.
Due to those events, there is a decrease in performance compared to the traditional
List
when adding and/or removing multiple elements at once (e.g. ILcdCollection.addAll(java.util.Collection)
or ILcdCollection.removeAll(java.util.Collection)
). For every element
that is added or removed, those methods should fire an individual event. An example
implementation for such a method is:
public boolean addAll( Collection extends T> aCollection ) {
boolean result = false;
for ( T element : aCollection ) {
result = add( element ) || result;
}
return result;
}
TLcdListEvent
,
ILcdListListener
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(int aIndex,
Collection<? extends T> aCollection) |
void |
addListListener(ILcdListListener<T> aListListener)
Register the listener
aListListener to be informed about changes in this
list. |
void |
removeListListener(ILcdListListener<T> aListListener)
Unregister the listener
aListListener so it will no longer be informed
about changes in this collection. |
T |
set(int aIndex,
T aElement) |
addAll, addCollectionListener, clear, removeAll, removeCollectionListener, retainAll
add, add, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
boolean addAll(int aIndex, Collection<? extends T> aCollection)
The elements should be added to the Collection
one by one, and an TLcdCollectionEvent
fired each time an element has been
added.
T set(int aIndex, T aElement)
Replacing the element should be performed in two distinct steps. First the removal of the element (including an event) and afterwards the adding of the new element (including an event).
void addListListener(ILcdListListener<T> aListListener)
Register the listener aListListener
to be informed about changes in this
list.
aListListener
- the listenerremoveListListener(ILcdListListener)
void removeListListener(ILcdListListener<T> aListListener)
Unregister the listener aListListener
so it will no longer be informed
about changes in this collection.
This method should do nothing when aListListener
was not registered
previously.
aListListener
- the listeneraddListListener(ILcdListListener)