public interface ILcdCollection<T> extends Collection<T>
An extension of the Java Collection
which fires an TLcdCollectionEvent
for every element that is added to or removed
from the collection.
Due to those events, there is a decrease in performance compared to the traditional
Collection
when adding and/or removing multiple elements at once (e.g. addAll(java.util.Collection)
or 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;
}
TLcdCollectionEvent
,
ILcdCollectionListener
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(Collection<? extends T> aCollection) |
void |
addCollectionListener(ILcdCollectionListener<T> aCollectionListener)
Register the listener
aCollectionListener to be informed about changes in this
collection. |
void |
clear() |
boolean |
removeAll(Collection<?> aCollection) |
void |
removeCollectionListener(ILcdCollectionListener<T> aCollectionListener)
Unregister the listener
aCollectionListener so it will no longer be informed
about changes in this collection. |
boolean |
retainAll(Collection<?> aCollection) |
add, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeIf, size, spliterator, stream, toArray, toArray
boolean addAll(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.
addAll
in interface Collection<T>
boolean removeAll(Collection<?> aCollection)
The elements should be removed from the Collection
one by one, and an TLcdCollectionEvent
fired each time an element has been
removed.
removeAll
in interface Collection<T>
boolean retainAll(Collection<?> aCollection)
The elements should be removed from the Collection
one by one, and an TLcdCollectionEvent
fired each time an element has been
removed.
retainAll
in interface Collection<T>
void clear()
The elements should be removed from the Collection
one by one, and an TLcdCollectionEvent
fired each time an element has been
removed.
clear
in interface Collection<T>
void addCollectionListener(ILcdCollectionListener<T> aCollectionListener)
Register the listener aCollectionListener
to be informed about changes in this
collection.
aCollectionListener
- the listenerremoveCollectionListener(ILcdCollectionListener)
void removeCollectionListener(ILcdCollectionListener<T> aCollectionListener)
Unregister the listener aCollectionListener
so it will no longer be informed
about changes in this collection.
This method should do nothing when addCollectionListener
was not registered
previously.
aCollectionListener
- the listeneraddCollectionListener(ILcdCollectionListener)