Interface ILcdList<T>
- All Superinterfaces:
Collection<T>
,ILcdCollection<T>
,Iterable<T>
,List<T>
,SequencedCollection<T>
- All Known Implementing Classes:
TLcdArrayList
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;
}
- Since:
- 9.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addAll
(int aIndex, Collection<? extends T> aCollection) void
addListListener
(ILcdListListener<T> aListListener) Register the listeneraListListener
to be informed about changes in this list.void
removeListListener
(ILcdListListener<T> aListListener) Unregister the listeneraListListener
so it will no longer be informed about changes in this collection.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface com.luciad.util.collections.ILcdCollection
addAll, addCollectionListener, clear, removeAll, removeCollectionListener, retainAll
Methods inherited from interface java.util.List
add, add, addAll, addFirst, addLast, clear, contains, containsAll, equals, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, size, sort, spliterator, subList, toArray, toArray
-
Method Details
-
addAll
The elements should be added to the
Collection
one by one, and anTLcdCollectionEvent
fired each time an element has been added. -
set
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).
-
addListListener
Register the listener
aListListener
to be informed about changes in this list.- Parameters:
aListListener
- the listener- See Also:
-
removeListListener
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.- Parameters:
aListListener
- the listener- See Also:
-