Class IterableContainerView<E>

Type Parameters:
E - is the type of the elements of a IterableContainerView.
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 IterableContainerView<E> extends AbstractExtendedContainer<E>
Author:
Silvan Wyss
  • Constructor Details

    • IterableContainerView

      public IterableContainerView()
      Creates a new IterableContainerView for a new empty container.
  • Method Details

    • forIterable

      public static <T> IterableContainerView<T> forIterable(Iterable<? extends T> iterable)
      Type Parameters:
      T - is the type of the elements of the given iterable.
      Parameters:
      iterable -
      Returns:
      a new IterableContainerView for the given iterable.
      Throws:
      RuntimeException - if the given iterable 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()
      The time complexity of this implementation is O(n). if the current IterableContainerView contains n elements.
      Overrides:
      toString in class Object
      Returns:
      a String representation of the current IterableContainerView.