Class ObservableListBase<E>
java.lang.Object
io.github.somesourcecode.someguiapi.collections.ObservableListBase<E>
- Type Parameters:
E- the type of elements in the list
- All Implemented Interfaces:
ObservableList<E>,Iterable<E>,Collection<E>,List<E>
A base implementation of an
ObservableList.
This class works as a wrapper around any List and fires
change events whenever elements are added or removed.
-
Constructor Summary
ConstructorsConstructorDescriptionObservableListBase(List<E> baseList) Constructs a new observable list with the specified base list. -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, @NotNull Collection<? extends E> c) booleanaddAll(@NotNull Collection<? extends E> c) booleanA convenience method to add varargs elements to the list.voidaddListener(ListChangeListener<? super E> listener) Adds a listener that is called whenever the list changes.voidclear()booleanbooleancontainsAll(Collection<?> c) get(int index) intbooleanisEmpty()iterator()int@NotNull ListIterator<E>@NotNull ListIterator<E>listIterator(int index) remove(int index) booleanbooleanA convenience method to remove varargs elements from the list.booleanremoveAll(Collection<?> c) voidremoveListener(ListChangeListener<? super E> listener) Removes a listener.booleanretainAll(@NotNull Collection<?> c) intsize()subList(int fromIndex, int toIndex) Object @NotNull []toArray()<T> T @NotNull []toArray(T @NotNull [] a) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
Constructor Details
-
ObservableListBase
Constructs a new observable list with the specified base list.- Parameters:
baseList- the base list
-
-
Method Details
-
addListener
Description copied from interface:ObservableListAdds a listener that is called whenever the list changes.- Specified by:
addListenerin interfaceObservableList<E>- Parameters:
listener- the listener
-
removeListener
Description copied from interface:ObservableListRemoves a listener.- Specified by:
removeListenerin interfaceObservableList<E>- Parameters:
listener- the listener
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T @NotNull [] toArray(T @NotNull [] a) -
add
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
subList
-
addAll
Description copied from interface:ObservableListA convenience method to add varargs elements to the list.- Specified by:
addAllin interfaceObservableList<E>- Parameters:
elements- the elements to add- Returns:
- true if the list was changed as a result of this call
-
removeAll
Description copied from interface:ObservableListA convenience method to remove varargs elements from the list.- Specified by:
removeAllin interfaceObservableList<E>- Parameters:
elements- the elements to remove- Returns:
- true if the list was changed as a result of this call
-