Interface ListIndex<T>

  • Type Parameters:
    T - the type of elements in this list
    All Superinterfaces:
    Iterable<T>
    All Known Implementing Classes:
    ListIndexProxy, ProofListIndexProxy

    public interface ListIndex<T>
    extends Iterable<T>
    A list index proxy is a contiguous list of elements.

    The "destructive" methods of the list, i.e., those that change its contents, are specified to throw UnsupportedOperationException if this list has been created with a read-only database view.

    When the corresponding view goes out of scope, this list is destroyed. Subsequent use of the closed list is prohibited and will result in IllegalStateException.

    This interface prohibits null elements. All method arguments are non-null by default.

    • Method Summary

      Modifier and Type Method Description
      void add​(T e)
      Adds a new element to the end of the list.
      void addAll​(Collection<? extends T> elements)
      Adds all elements from the specified collection to this list.
      void clear()
      Clears the list.
      T get​(long index)
      Returns the element at the given index.
      T getLast()
      Returns the last element of the list.
      String getName()
      Returns the name of this index.
      boolean isEmpty()
      Returns true if the list is empty, false — otherwise.
      Iterator<T> iterator()
      Returns an iterator over the elements of the list.
      void set​(long index, T e)
      Replaces the element at the given index of the list with the specified element.
      long size()
      Returns the number of elements in the list.
      Stream<T> stream()
      Returns a stream of elements in this list.
    • Method Detail

      • addAll

        void addAll​(Collection<? extends T> elements)
        Adds all elements from the specified collection to this list.

        If the collection contains an invalid element, this list is not modified.

        Parameters:
        elements - elements to add to this list
        Throws:
        NullPointerException - if the collection is null or it contains null elements. In this case the collection is not modified.
        IllegalStateException - if this list is not valid
        UnsupportedOperationException - if this list is read-only
      • get

        T get​(long index)
        Returns the element at the given index.
        Parameters:
        index - an index of the element to return
        Returns:
        an element at the given index
        Throws:
        IndexOutOfBoundsException - if index is invalid
        IllegalStateException - if this list is not valid
      • isEmpty

        boolean isEmpty()
        Returns true if the list is empty, false — otherwise.
        Throws:
        IllegalStateException - if this list is not valid
      • size

        long size()
        Returns the number of elements in the list.
        Throws:
        IllegalStateException - if this list is not valid
      • iterator

        Iterator<T> iterator()
        Returns an iterator over the elements of the list.

        Any destructive operation on the same Fork this list uses (but not necessarily on this list) will invalidate the iterator.

        Specified by:
        iterator in interface Iterable<T>
        Throws:
        IllegalStateException - if this list is not valid
      • stream

        Stream<T> stream()
        Returns a stream of elements in this list. The returned stream is fail-fast and late-binding; the stream can be used as long as the source list is valid.

        Any destructive operation on the same Fork this list uses (but not necessarily on this list) will invalidate the corresponding spliterator.

        Throws:
        IllegalStateException - if this list is not valid
      • getName

        String getName()
        Returns the name of this index.