IViewableList

interface IViewableList<out V : Any> : List<V> , IViewable<Pair<Int, V>> , ISource<IViewableList.Event<V>>

A list allowing its contents to be observed.

Types

Link copied to clipboard
sealed class Event<out V>

Represents an addition, update or removal of an element in the list.

Functions

Link copied to clipboard
abstract fun advise(lifetime: Lifetime, handler: (IViewableList.Event<V>) -> Unit)

Adds an event subscription. Every time an event occurs, the handler is called, receiving an instance of the event. The subscription is removed when the given lifetime expires.

Link copied to clipboard
open fun adviseAddRemove(lifetime: Lifetime, handler: (AddRemove, Int, V) -> Unit)

Adds a subscription to additions and removals of list elements. When a list element is updated, the handler is called twice: to report the removal of the old element and the addition of the new one.

Link copied to clipboard
abstract operator override fun contains(element: V): Boolean
Link copied to clipboard
abstract override fun containsAll(elements: Collection<V>): Boolean
Link copied to clipboard
open fun forEach(p0: Consumer<in V>)
Link copied to clipboard
abstract operator fun get(index: Int): V
Link copied to clipboard
abstract fun indexOf(element: V): Int
Link copied to clipboard
abstract override fun isEmpty(): Boolean
Link copied to clipboard
abstract operator override fun iterator(): Iterator<V>
Link copied to clipboard
abstract fun lastIndexOf(element: V): Int
Link copied to clipboard
abstract fun listIterator(): ListIterator<V>
abstract fun listIterator(index: Int): ListIterator<V>
Link copied to clipboard
open fun parallelStream(): Stream<V>
Link copied to clipboard
open override fun spliterator(): Spliterator<V>
Link copied to clipboard
open fun stream(): Stream<V>
Link copied to clipboard
abstract fun subList(fromIndex: Int, toIndex: Int): List<V>
Link copied to clipboard
open fun <T : Any> toArray(p0: IntFunction<Array<T>>): Array<T>
Link copied to clipboard
open override fun view(lifetime: Lifetime, handler: (Lifetime, Pair<Int, V>) -> Unit)

Adds a subscription to changes of the contents of the list.

open fun view(lifetime: Lifetime, handler: (Lifetime, Int, V) -> Unit)

Adds a subscription to changes of the contents of the list, receiving the index and value as separate parameters.

Properties

Link copied to clipboard
abstract val change: ISource<IViewableList.Event<V>>
Link copied to clipboard
abstract override val size: Int

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun <T : Any> IViewableList<T>.viewableTail(): IPropertyView<T?>

Returns a property which evaluates to the last element of the list and is updated as elements are added to the list or removed from it.