Interface List<E>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @NotNull List<E> append​(E elem)
      Returns a list with the specified element appended to the bottom of the list.
      java.util.List<E> asList()
      Returns an immutable view of this list as an instance of java.util.List.
      @NotNull List<E> drop​(int number)
      Returns a list containing all elements in this list, excluding the first number of elements.
      E first()
      Returns first element in the list or null if the list is empty.
      E get​(int i)
      Returns the element at the specified index in this list (zero-based).
      int indexOf​(E elem)
      Returns the index of the first occurrence of the specified element in the list or -1 if there are no occurrences.
      E last()
      Returns last element in the list or null if the list is empty.
      int lastIndexOf​(E elem)
      Returns the index of the last occurrence of the specified element in the list or -1 if there are no occurrences.
      @NotNull List<E> prepend​(E elem)
      Returns a list with the specified element prepended to the top of the list.
      @NotNull List<E> range​(int from, boolean fromInclusive, int to, boolean toInclusive)
      Returns a list containing a contiguous range of elements from this list.
      @NotNull List<E> set​(int i, E elem)
      Returns a list with the element set to the value specified at the index (zero-based).
      @NotNull List<E> tail()
      Returns a list containing all elements in the list, excluding the first element.
      @NotNull List<E> take​(int number)
      Returns a list containing the first number of elements from this list.
      • Methods inherited from interface com.github.andrewoma.dexx.collection.Iterable

        iterator
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • get

        E get​(int i)
        Returns the element at the specified index in this list (zero-based).
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range
      • set

        @NotNull
        @NotNull List<E> set​(int i,
                             E elem)
        Returns a list with the element set to the value specified at the index (zero-based).
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range
      • append

        @NotNull
        @NotNull List<E> append​(E elem)
        Returns a list with the specified element appended to the bottom of the list.
      • prepend

        @NotNull
        @NotNull List<E> prepend​(E elem)
        Returns a list with the specified element prepended to the top of the list.
      • indexOf

        int indexOf​(E elem)
        Returns the index of the first occurrence of the specified element in the list or -1 if there are no occurrences.
      • lastIndexOf

        int lastIndexOf​(E elem)
        Returns the index of the last occurrence of the specified element in the list or -1 if there are no occurrences.
      • first

        @Nullable
        E first()
        Returns first element in the list or null if the list is empty.
      • last

        @Nullable
        E last()
        Returns last element in the list or null if the list is empty.
      • tail

        @NotNull
        @NotNull List<E> tail()
        Returns a list containing all elements in the list, excluding the first element. An empty list is returned if the list is empty.
      • drop

        @NotNull
        @NotNull List<E> drop​(int number)
        Returns a list containing all elements in this list, excluding the first number of elements.
      • take

        @NotNull
        @NotNull List<E> take​(int number)
        Returns a list containing the first number of elements from this list.
      • range

        @NotNull
        @NotNull List<E> range​(int from,
                               boolean fromInclusive,
                               int to,
                               boolean toInclusive)
        Returns a list containing a contiguous range of elements from this list.
        Parameters:
        from - starting index for the range (zero-based)
        fromInclusive - if true, the element at the from index will be included
        to - end index for the range (zero-based)
        toInclusive - if true, the element at the to index will be included
      • asList

        @NotNull
        java.util.List<E> asList()
        Returns an immutable view of this list as an instance of java.util.List.