Class MultiList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
org.eclipse.core.databinding.observable.list.AbstractObservableList<E>
org.eclipse.core.databinding.observable.list.MultiList<E>
- Type Parameters:
E
- the type of the elements in the list
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,List<E>
,SequencedCollection<E>
,IObservable
,IObservableCollection<E>
,IObservableList<E>
An observable list backed by an array of observable lists. This class
supports all removal methods (including
clear()
), as well as the
set(int, Object)
method. All other mutator methods (addition methods
and move(int, int)
) throw an UnsupportedOperationException
.- Since:
- 1.2
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionMultiList
(List<IObservableList<E>> lists) Constructs a MultiList in the default realm, and backed by the given observable lists.MultiList
(List<IObservableList<E>> lists, Object elementType) Constructs a MultiList in the default realm backed by the given observable lists.MultiList
(IObservableList<E>[] lists) Deprecated.MultiList
(IObservableList<E>[] lists, Object elementType) Deprecated.useMultiList(List, Object)
insteadConstructs a MultiList belonging to the given realm, and backed by the given observable lists.MultiList
(Realm realm, IObservableList<E>[] lists) Constructs a MultiList belonging to the given realm, and backed by the given observable lists.MultiList
(Realm realm, IObservableList<E>[] lists, Object elementType) Deprecated.useMultiList(Realm, List, Object)
instead -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, Collection<? extends E> c) boolean
addAll
(Collection<? extends E> c) void
clear()
boolean
void
dispose()
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.protected int
boolean
protected void
get
(int index) Returns the element type of this observable collection, ornull
if this observable collection is untyped.int
hashCode()
int
boolean
isEmpty()
boolean
isStale()
Returns whether the state of this observable is stale and is expected to change soon.iterator()
int
protected void
listIterator
(int index) move
(int oldIndex, int newIndex) Moves the element located atoldIndex
tonewIndex
.remove
(int index) boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) Methods inherited from class org.eclipse.core.databinding.observable.list.AbstractObservableList
addChangeListener, addDisposeListener, addListChangeListener, addStaleListener, checkRealm, containsAll, fireChange, fireListChange, fireStale, getRealm, hasListeners, isDisposed, removeChangeListener, removeDisposeListener, removeListChangeListener, removeStaleListener, size, toArray, toArray
Methods inherited from class java.util.AbstractList
listIterator, removeRange, subList
Methods inherited from class java.util.AbstractCollection
toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface org.eclipse.core.databinding.observable.list.IObservableList
listIterator, subList
Methods inherited from interface java.util.List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Constructor Details
-
MultiList
Deprecated.useMultiList(List)
insteadConstructs a MultiList in the default realm, and backed by the given observable lists.- Parameters:
lists
- the array of observable lists backing this MultiList.
-
MultiList
Constructs a MultiList in the default realm, and backed by the given observable lists.- Parameters:
lists
- the array of observable lists backing this MultiList.- Since:
- 1.6
-
MultiList
Deprecated.useMultiList(List, Object)
insteadConstructs a MultiList in the default realm backed by the given observable lists.- Parameters:
lists
- the array of observable lists backing this MultiList.elementType
- element type of the constructed list.
-
MultiList
Constructs a MultiList in the default realm backed by the given observable lists.- Parameters:
lists
- the array of observable lists backing this MultiList.elementType
- element type of the constructed list.- Since:
- 1.6
-
MultiList
Constructs a MultiList belonging to the given realm, and backed by the given observable lists.- Parameters:
realm
- the observable's realmlists
- the array of observable lists backing this MultiList
-
MultiList
Deprecated.useMultiList(Realm, List, Object)
insteadConstructs a MultiList belonging to the given realm, and backed by the given observable lists.- Parameters:
realm
- the observable's realmlists
- the array of observable lists backing this MultiListelementType
- element type of the constructed list.
-
MultiList
Constructs a MultiList belonging to the given realm, and backed by the given observable lists.- Parameters:
realm
- the observable's realmlists
- the array of observable lists backing this MultiListelementType
- element type of the constructed list.- Since:
- 1.6
-
-
Method Details
-
firstListenerAdded
protected void firstListenerAdded()- Overrides:
firstListenerAdded
in classAbstractObservableList<E>
-
lastListenerRemoved
protected void lastListenerRemoved()- Overrides:
lastListenerRemoved
in classAbstractObservableList<E>
-
doGetSize
protected int doGetSize()- Specified by:
doGetSize
in classAbstractObservableList<E>
- Returns:
- the size
-
getElementType
Description copied from interface:IObservableCollection
Returns the element type of this observable collection, ornull
if this observable collection is untyped.- Returns:
- the type of the elements or
null
if untyped
-
add
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceIObservableList<E>
- Specified by:
add
in interfaceList<E>
- Overrides:
add
in classAbstractObservableList<E>
-
add
-
addAll
- Specified by:
addAll
in interfaceCollection<E>
- Specified by:
addAll
in interfaceIObservableList<E>
- Specified by:
addAll
in interfaceList<E>
- Overrides:
addAll
in classAbstractObservableList<E>
-
addAll
- Specified by:
addAll
in interfaceIObservableList<E>
- Specified by:
addAll
in interfaceList<E>
- Overrides:
addAll
in classAbstractObservableList<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceList<E>
- Overrides:
clear
in classAbstractList<E>
-
get
- Specified by:
get
in interfaceIObservableList<E>
- Specified by:
get
in interfaceList<E>
- Specified by:
get
in classAbstractList<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceIObservableList<E>
- Specified by:
contains
in interfaceList<E>
- Overrides:
contains
in classAbstractObservableList<E>
-
equals
- Specified by:
equals
in interfaceCollection<E>
- Specified by:
equals
in interfaceIObservableList<E>
- Specified by:
equals
in interfaceList<E>
- Overrides:
equals
in classAbstractObservableList<E>
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<E>
- Specified by:
hashCode
in interfaceIObservableList<E>
- Specified by:
hashCode
in interfaceList<E>
- Overrides:
hashCode
in classAbstractObservableList<E>
-
indexOf
- Specified by:
indexOf
in interfaceIObservableList<E>
- Specified by:
indexOf
in interfaceList<E>
- Overrides:
indexOf
in classAbstractObservableList<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceIObservableList<E>
- Specified by:
isEmpty
in interfaceList<E>
- Overrides:
isEmpty
in classAbstractObservableList<E>
-
iterator
- Specified by:
iterator
in interfaceCollection<E>
- Specified by:
iterator
in interfaceIObservableList<E>
- Specified by:
iterator
in interfaceIterable<E>
- Specified by:
iterator
in interfaceList<E>
- Overrides:
iterator
in classAbstractObservableList<E>
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceIObservableList<E>
- Specified by:
lastIndexOf
in interfaceList<E>
- Overrides:
lastIndexOf
in classAbstractObservableList<E>
-
listIterator
- Specified by:
listIterator
in interfaceIObservableList<E>
- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in classAbstractList<E>
-
move
Description copied from class:AbstractObservableList
Moves the element located atoldIndex
tonewIndex
. This method is equivalent to callingadd(newIndex, remove(oldIndex))
.Subclasses should override this method to deliver list change notification for the remove and add operations in the same ListChangeEvent, as this allows
ListDiff.accept(ListDiffVisitor)
to recognize the operation as a move.- Specified by:
move
in interfaceIObservableList<E>
- Overrides:
move
in classAbstractObservableList<E>
- Parameters:
oldIndex
- the element's position before the move. Must be within the range0 <= oldIndex < size()
.newIndex
- the element's position after the move. Must be within the range0 <= newIndex < size()
.- Returns:
- the element that was moved.
- See Also:
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceIObservableList<E>
- Specified by:
remove
in interfaceList<E>
- Overrides:
remove
in classAbstractObservableList<E>
-
remove
- Specified by:
remove
in interfaceIObservableList<E>
- Specified by:
remove
in interfaceList<E>
- Overrides:
remove
in classAbstractList<E>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
- Specified by:
removeAll
in interfaceIObservableList<E>
- Specified by:
removeAll
in interfaceList<E>
- Overrides:
removeAll
in classAbstractObservableList<E>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E>
- Specified by:
retainAll
in interfaceIObservableList<E>
- Specified by:
retainAll
in interfaceList<E>
- Overrides:
retainAll
in classAbstractObservableList<E>
-
set
- Specified by:
set
in interfaceIObservableList<E>
- Specified by:
set
in interfaceList<E>
- Overrides:
set
in classAbstractList<E>
-
isStale
public boolean isStale()Description copied from interface:IObservable
Returns whether the state of this observable is stale and is expected to change soon. A non-stale observable that becomes stale will notify its stale listeners. A stale object that becomes non-stale does so by changing its state and notifying its change listeners, it does not notify its stale listeners about becoming non-stale. Clients that do not expect asynchronous changes may ignore staleness of observable objects.- Specified by:
isStale
in interfaceIObservable
- Overrides:
isStale
in classAbstractObservableList<E>
- Returns:
- true if this observable's state is stale and will change soon.
-
dispose
public void dispose()Description copied from interface:IObservable
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.- Specified by:
dispose
in interfaceIObservable
- Overrides:
dispose
in classAbstractObservableList<E>
-
MultiList(List)
instead