Package 

Class ObservableList

    • Method Summary

      Modifier and Type Method Description
      final Integer getSize()
      final IntRange getIndices()
      abstract List<T> getList() List field.
      final Boolean isEmpty() Returns true if this list contains no elements.
      final Boolean isNotEmpty() Returns true if this list contains elements.
      final Boolean contains(Object o) Returns true if this list contains the specified element.
      final Integer indexOf(Object o) Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
      final Integer lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
      final T get(Integer index) Returns the element at the specified position in this list.
      final T set(Integer index, T element) Replaces the element at the specified position in this list with the specified element.
      final Boolean add(T element) Appends the specified element to the end of this list.
      final Unit add(Integer index, T element) Inserts the specified element at the specified position in this list.
      final Boolean remove(T o) Removes the first occurrence of the specified element from this list, if it is present.
      final T removeAt(Integer index) Removes an element at the specified index from the list.
      final T removeFirstOrNull() Removes the first element from this list and returns that removed element, or returns null if this list is empty.
      final T removeFirst() Removes the first element from this list and returns that removed element.
      final T removeLastOrNull() Removes the last element from this list and returns that removed element, or returns null if this list is empty.
      final T removeLast() Removes the last element from this list and returns that removed element.
      final Unit clear() Removes all elements from this list.
      final Boolean addAll(Collection<T> elements) 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.
      final Boolean addAll(Integer index, Collection<T> elements) Inserts all elements in the specified collection into this list, starting at the specified position.
      final Boolean removeAll(Collection<?> elements) Removes from this list all of its elements that are contained in the specified collection.
      final Boolean retainAll(Collection<?> elements) Retains only the elements in this list that are contained in the specified collection.
      final List<T> subList(Integer fromIndex, Integer toIndex) Returns a view of the portion of this list between the specified fromIndex inclusive and toIndex exclusive.
      final Unit forEach(Consumer<in T> action) ForEach action.
      final Spliterator<T> spliterator() Creates a fail-fastSpliterator over the elements in this list.
      final Boolean removeIf(Predicate<in T> filter) Removes all elements of this collection that satisfy the given predicate.
      final Unit replaceAll(UnaryOperator<T> operator) Replaces each element of this list with the result of applying the operator to that element.
      final Unit sort(Comparator<in T> comparator) Sorts this list by given comparator.
      Iterator<T> iterator() Returns an Iterator over the elements in this ObservableList.
      • Methods inherited from class tools.aqua.bgw.observable.ObservableList

        addListener, addListenerAndInvoke, clearListeners, removeListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • isEmpty

         final Boolean isEmpty()

        Returns true if this list contains no elements.

      • contains

         final Boolean contains(Object o)

        Returns true if this list contains the specified element.

        More formally, returns true if and only if this list contains at least one element e such that Objects.equals(o, e).

        Parameters:
        o - Element whose presence in this list is to be tested.
      • indexOf

         final Integer indexOf(Object o)

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

        More formally, returns the lowest index i such that Objects.equals(o, get(i)), or -1 if there is no such index.

      • lastIndexOf

         final Integer lastIndexOf(Object o)

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

        More formally, returns the highest index i such that Objects.equals(o, get(i)), or -1 if there is no such index.

      • get

         final T get(Integer index)

        Returns the element at the specified position in this list.

        Parameters:
        index - Index of the element to return.
      • set

         final T set(Integer index, T element)

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

        Parameters:
        index - Index of the element to replace.
        element - Element to be stored at the specified position.
      • add

         final Boolean add(T element)

        Appends the specified element to the end of this list.

        Parameters:
        element - Element to be appended to this list.
      • add

         final Unit add(Integer index, T element)

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

        Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

        Parameters:
        index - Index at which the specified element is to be inserted.
        element - Element to be inserted.
      • remove

         final Boolean remove(T o)

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

        If the list does not contain the element, it is unchanged.

        More formally, removes the element with the lowest index i such that Objects.equals(o, get(i)) (if such an element exists).

        Returns true if this list contained the specified element (or equivalently, if this list changed as a result of the call).

        Parameters:
        o - Element to be removed from this list, if present.
      • removeFirstOrNull

         final T removeFirstOrNull()

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

      • removeFirst

         final T removeFirst()

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

      • removeLastOrNull

         final T removeLastOrNull()

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

      • removeLast

         final T removeLast()

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

      • clear

         final Unit clear()

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

      • addAll

         final Boolean addAll(Collection<T> elements)

        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.

        The behavior of this operation is undefined if the specified collection is modified while the operation is in progress (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty).

        Parameters:
        elements - Collection containing elements to be added to this list.
      • addAll

         final Boolean addAll(Integer index, Collection<T> elements)

        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.

        Parameters:
        index - Index at which to insert the first element from the specified collection.
        elements - Collection containing elements to be added to this list.
      • removeAll

         final Boolean removeAll(Collection<?> elements)

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

        Parameters:
        elements - Collection containing elements to be removed from this list.
      • retainAll

         final Boolean retainAll(Collection<?> elements)

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

        In other words, removes from this list all of its elements that are not contained in the specified collection.

        Parameters:
        elements - Collection containing elements to be retained in this list.
      • subList

         final List<T> subList(Integer fromIndex, Integer toIndex)

        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.)

        The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa.

        The returned list supports all optional list operations.

        This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays).

        Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list.

        For example, the following idiom removes a range of elements from a list:

        <pre> list.subList(from, to).clear(); </pre>

        Similar idioms may be constructed for .indexOf and .lastIndexOf, and all algorithms in the Collections class can be applied to a subList.

        The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.).

      • removeIf

         final Boolean removeIf(Predicate<in T> filter)

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

        Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller.

        Parameters:
        filter - A predicate which returns true for elements to be removed.
      • replaceAll

         final Unit replaceAll(UnaryOperator<T> operator)

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

        Parameters:
        operator - The operator to apply to each element.