Class ContainerView<E>

Type Parameters:
E - is the type of the elements of a ContainerView.
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 ContainerView<E> extends AbstractExtendedContainer<E>
A ContainerView wraps one or several given Iterables or arrays. A ContainerView prevents that its accessed Iterables or arrays are mutated. A ContainerView does not prevent that the elements of its Iterable or array are mutated.
Author:
Silvan Wyss
  • Method Details

    • createEmpty

      public static <T> ContainerView<T> createEmpty()
      Type Parameters:
      T - is the types the elements the ContainerView would have.
      Returns:
      an empty ContainerView.
    • forArray

      public static <T> ContainerView<T> forArray(T[] array)
      Type Parameters:
      T - is the type of the elements of the given array.
      Parameters:
      array -
      Returns:
      a new ContainerView for the given array.
      Throws:
      RuntimeException - if the given array is null.
    • forArrays

      @SafeVarargs public static <T> ContainerView<T> forArrays(T[]... arrays)
      Type Parameters:
      T - is the type of the elements of the given arrays.
      Parameters:
      arrays -
      Returns:
      a new ContainerView for the given arrays.
      Throws:
      RuntimeException - if the given arrays is null.
      RuntimeException - if one of the given arrays is null.
    • forElementAndArray

      public static <T> ContainerView<T> forElementAndArray(T element, T[] array)
      Type Parameters:
      T - is the type of the given element and the elements of the given array.
      Parameters:
      element -
      array -
      Returns:
      a new ContainerView for the given element and array.
      Throws:
      RuntimeException - if the given array is null.
    • forIterable

      public static <T> ContainerView<T> forIterable(Iterable<T> iterable)
      Type Parameters:
      T - is the type of the elements of the given iterable.
      Parameters:
      iterable -
      Returns:
      a new ContainerView for the given iterable.
      Throws:
      RuntimeException - if the given iterable is null.
    • forIterableAndElement

      public static <T> ContainerView<T> forIterableAndElement(Iterable<T> iterable, T element)
      Type Parameters:
      T - is the type of the elements of the given iterable and element.
      Parameters:
      iterable -
      element -
      Returns:
      a new ContainerView for the given iterable and element.
      Throws:
      RuntimeException - if the given iterable is null.
    • forIterables

      @SafeVarargs public static <T> ContainerView<T> forIterables(Iterable<? extends T>... iterables)
      Type Parameters:
      T - is the type of the elements of the given iterables.
      Parameters:
      iterables -
      Returns:
      a new ContainerView for the given iterables.
      Throws:
      RuntimeException - if the given iterables is null.
      RuntimeException - if one of the given iterables is null.
    • equals

      public boolean equals(Object object)
      A Object equals a ContainerView when the object is a Iterable that contains exactly the same elements in the same order as the ContainerView.
      Overrides:
      equals in class Object
    • 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.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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