Klasse ContainerView<E>

java.lang.Object
ch.nolix.core.container.base.Container<E>
ch.nolix.core.container.base.ContainerView<E>
Typparameter:
E - is the type of the elements of a ContainerView.
Alle implementierten Schnittstellen:
IContainer<E>, IViewProviderContainer<E>, Mappable<E>, MultiSearchable<E>, ArrayMappable<E>, ICountingContainer<E>, IndexRequestable<E>, IStatisticalConainer<E>, IterableWithCopyableIterator<E>, SingleSearchable<E>, StoringRequestable<E>, StringMappable, EmptinessRequestable, MaterializationRequestable, Iterable<E>

public final class ContainerView<E> extends Container<E>
A ContainerView can iterate over a part of another container. A ContainerView must not use the methods of the accessed container except the iterator method. The reason is that the accessed container can be a specialized container that does not use its iterator in any of its declared or overwritten method.
Version:
2017-08-27
Autor:
Silvan Wyss
  • Methodendetails

    • forContainerAndStartIndexAndEndIndex

      public static <E2> ContainerView<E2> forContainerAndStartIndexAndEndIndex(Container<E2> container, int startIndex, int endIndex)
      Typparameter:
      E2 - is the type of the elements of the created ContainerView.
      Parameter:
      container -
      startIndex -
      endIndex -
      Gibt zurück:
      a new ContainerView with the given container, startIndex and endIndex.
      Löst aus:
      ArgumentIsNullException - if the given container is null.
      NonPositiveArgumentException - if the given startIndex is not positive.
      NonPositiveArgumentException - if the given endIndex is not positive.
      SmallerArgumentException - if the given endIndex is smaller than the given startIndex.
      BiggerArgumentException - if the given endIndex is bigger than the number of elements of the given container.
    • getCount

      public int getCount()
      Gibt zurück:
      the number of elements of the current ICountingContainer.
    • getStoredAt1BasedIndex

      public E getStoredAt1BasedIndex(int param1BasedIndex)
      Parameter:
      param1BasedIndex -
      Gibt zurück:
      the element at the given param1BasedIndex. The element can be null.
    • isMaterialized

      public boolean isMaterialized()
      Gibt zurück:
      true if the current MaterializationRequestable is materialized, false otherwise.
    • iterator

      public CopyableIterator<E> iterator()
    • toOrderedList

      public <C extends Comparable<C>> IContainer<E> toOrderedList(Function<E,C> norm)
      Typparameter:
      C - is the type of the Comparables the given comparableMapper returns.
      Parameter:
      norm -
      Gibt zurück:
      a new IContainer with the elements of the current IContainer ordered from the smallest to the biggest element according to the Comparables the given comparableMapper maps from the elements of the current IContainer.
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • createEmptyMutableList

      protected <E2> ILinkedList<E2> createEmptyMutableList(Marker<E2> marker)
      Angegeben von:
      createEmptyMutableList in Klasse Container<E>
      Typparameter:
      E2 - is the type of the elements the created ILinkedList can contain.
      Parameter:
      marker -
      Gibt zurück:
      a new empty ILinkedList.