Class ImmutableList<E>

Type Parameters:
E - is the type of the elements of a ImmutableList.
All Implemented Interfaces:
Filterable<E>, Groupable<E>, IContainer<E>, IFilteringContainerViewProvider<E>, IIntervallContainerViewProvider<E>, IMappingContainerViewProvider<E>, Mappable<E>, AggregationRequestable<E>, ArrayMappable<E>, CountRequestable<E>, IndexRequestable<E>, IterableWithCopyableIterator<E>, SingleSearchable<E>, StoringRequestable<E>, StringMappable, EmptinessRequestable, MaterializationRequestable, Iterable<E>

public final class ImmutableList<E> extends AbstractExtendedContainer<E>
A ImmutableList is not mutable.
Author:
Silvan Wyss
  • Method Details

    • createEmpty

      public static <T> ImmutableList<T> createEmpty()
      Type Parameters:
      T - is the type of the elements the ImmutableList would have.
      Returns:
      a new empty ImmutableList.
    • fromArray

      public static <T> ImmutableList<T> fromArray(T[] array)
    • fromIterable

      public static <T> ImmutableList<T> fromIterable(Iterable<T> iterable)
      Type Parameters:
      T -
      Parameters:
      iterable -
      Returns:
      a new ImmutableList with the elements of the given iterable.
      Throws:
      RuntimeException - if the given iterable is null.
      RuntimeException - if one of the elements of the given iterable is null.
    • fromStream

      public static <T> ImmutableList<T> fromStream(Stream<T> stream)
      Type Parameters:
      T - is the type of the elements of the given stream.
      Parameters:
      stream -
      Returns:
      a new ImmutableList with the elements from the given stream.
      Throws:
      RuntimeException - if the given stream is null.
      RuntimeException - if one of the elements of the given stream is null.
    • withElement

      public static <T> ImmutableList<T> withElement(T element)
      Type Parameters:
      T - is the type of the given element.
      Parameters:
      element -
      Returns:
      a new ImmutableList with the given element.
      Throws:
      RuntimeException - if the given element is null.
    • withElements

      @SafeVarargs public static <T> ImmutableList<T> withElements(T... elements)
      Type Parameters:
      T - is the type of the given elements.
      Parameters:
      elements -
      Returns:
      a new ImmutableList with the given elements.
      Throws:
      RuntimeException - if the given elements is null.
      RuntimeException - if one of the given elements is null.
    • getCount

      public int getCount()
      Returns:
      the number of elements of the current CountRequestable.
    • getStoredAtOneBasedIndex

      public E getStoredAtOneBasedIndex(int oneBasedIndex)
      Parameters:
      oneBasedIndex -
      Returns:
      the element at the given oneBasedIndex. The element can be null.
    • isMaterialized

      public boolean isMaterialized()
      Returns:
      true if the current MaterializationRequestable is materialized, false otherwise.
    • iterator

      public CopyableIterator<E> iterator()
    • toString

      public String toString()
      Overrides:
      toString in class Object