ObservableList

abstract class ObservableList<T> : ReadonlyObservableList<T>

An observable List implementation.

Constructors

Link copied to clipboard
fun ObservableList()

Creates an ObservableList.

Functions

Link copied to clipboard
fun add(element: T): Boolean

Appends the specified element to the end of this list.

fun add(index: Int, element: T)

Inserts the specified element at the specified position in this list.

Link copied to clipboard
fun addAll(elements: Collection<T>): Boolean

Appends all elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.

fun addAll(index: Int, elements: Collection<T>): Boolean

Inserts all elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.

Link copied to clipboard
fun addListener(listener: ValueObserver<List<T>>)

Adds a listener silently.

Link copied to clipboard
fun addListenerAndInvoke(initialValue: List<T>, listener: (List<T>, List<T>) -> Unit)

Adds a listener and calls ValueObserver.update on this new listener with given initial value.

Link copied to clipboard
fun clear()

Removes all elements from this list. The list will be empty after this call returns.

Link copied to clipboard
fun clearListeners()

Removes all listeners.

Link copied to clipboard
operator fun contains(o: Any?): Boolean

Returns true if this list contains the specified element.

Link copied to clipboard
open fun forEach(p0: Consumer<in T>)
Link copied to clipboard
operator fun get(index: Int): T

Returns the element at the specified position in this list.

Link copied to clipboard
fun getOrNull(index: Int): T?

May return the element at the specified position in this list or null.

Link copied to clipboard
fun indexOf(o: Any?): Int

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

Link copied to clipboard
fun isEmpty(): Boolean

Returns true if this list contains no elements.

Link copied to clipboard
fun isNotEmpty(): Boolean

Returns true if this list contains elements.

Link copied to clipboard
open operator override fun iterator(): Iterator<T>

Returns an Iterator over the elements in this ReadonlyObservableList.

Link copied to clipboard
fun lastIndexOf(o: Any?): Int

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

Link copied to clipboard
fun remove(o: T): Boolean

Removes the first occurrence of the specified element from this list, if it is present.

Link copied to clipboard
fun removeAll(elements: Collection<*>): Boolean

Removes from this list all of its elements that are contained in the specified collection.

Link copied to clipboard
fun removeAt(index: Int): T

Removes an element at the specified index from the list.

Link copied to clipboard
fun removeFirst(): T

Removes the first element from this list and returns that removed element.

Link copied to clipboard
fun removeFirstOrNull(): T?

Removes the first element from this list and returns that removed element, or returns null if this list is empty.

Link copied to clipboard
fun removeIf(filter: Predicate<in T>): Boolean

Removes all elements of this collection that satisfy the given predicate.

Link copied to clipboard
fun removeLast(): T

Removes the last element from this list and returns that removed element.

Link copied to clipboard
fun removeLastOrNull(): T?

Removes the last element from this list and returns that removed element, or returns null if this list is empty.

Link copied to clipboard
fun removeListener(listener: ValueObserver<List<T>>): Boolean

Removes a listener.

Link copied to clipboard
fun removeSilent(o: T): Boolean

removes o from the ObservableList silently.

Link copied to clipboard
fun replaceAll(operator: UnaryOperator<T>)

Replaces each element of this list with the result of applying the operator to that element.

Link copied to clipboard
fun retainAll(elements: Collection<*>): Boolean

Retains only the elements in this list that are contained in the specified collection.

Link copied to clipboard
operator fun set(index: Int, element: T): T

Replaces the element at the specified position in this list with the specified element.

Link copied to clipboard
fun setAll(elements: Collection<T>): Boolean

Sets all elements in the specified collection as the new contents of this list, in the order that they are returned by the specified collection's Iterator. Clears all items currently in this list.

Link copied to clipboard
fun sort(comparator: Comparator<in T>)

Sorts this list by given comparator.

Link copied to clipboard
override fun spliterator(): Spliterator<T>

Creates a fail-fastSpliterator over the elements in this list.

Link copied to clipboard
fun subList(fromIndex: Int, toIndex: Int): List<T>

Returns a view of the portion of this list between the specified fromIndex inclusive and toIndex exclusive. (If fromIndex and toIndex are equal, the returned list is empty.)

Properties

Link copied to clipboard
val indices: IntRange

All available indices of this list as IntRange i.e. 0..size()-1.

Link copied to clipboard
val size: Int

Returns the number of elements in this list.

Inheritors

Link copied to clipboard
Link copied to clipboard