Klasse ArrayList<E>

java.lang.Object
ch.nolix.core.container.base.Container<E>
ch.nolix.core.container.arraylist.ArrayList<E>
Typparameter:
E - is the type of the elements of a ArrayList.
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, IArrayList<E>, Copyable<IArrayList<E>>, Clearable, EmptinessRequestable, MaterializationRequestable, Iterable<E>

public final class ArrayList<E> extends Container<E> implements IArrayList<E>
Version:
2024-01-30
Autor:
Silvan Wyss
  • Methodendetails

    • createEmpty

      public static <E2> ArrayList<E2> createEmpty()
      Typparameter:
      E2 - is the type of the elements of the ArrayList.
      Gibt zurück:
      a new empty ArrayList.
    • withElement

      public static <E2> ArrayList<E2> withElement(E2 element, E2... elements)
      Typparameter:
      E2 - is the type of the given element and the given elements.
      Parameter:
      element -
      elements -
      Gibt zurück:
      a new ArrayList with the given element and elements.
      Löst aus:
      ArgumentIsNullException - if the given element is null.
      ArgumentIsNullException - if the given elements is null.
      ArgumentIsNullException - if one of the given elements is null.
    • withElements

      public static <E2> ArrayList<E2> withElements(E2[] elements)
      The time complexity of this implementation is O(n) when n elements are given.
      Typparameter:
      E2 - is the type of the given elements.
      Parameter:
      elements -
      Gibt zurück:
      a new ArrayList with the given elements.
      Löst aus:
      ArgumentIsNullException - if the given elements is null.
      ArgumentIsNullException - if one of the given elements is null.
    • withInitialCapacity

      public static <E2> ArrayList<E2> withInitialCapacity(int initialCapacity)
      The time complexity of this implementation is O(1).
      Typparameter:
      E2 - is the type of the elements of the created ArrayList.
      Parameter:
      initialCapacity -
      Gibt zurück:
      a new ArrayList with the given initialCapacity
      Löst aus:
      NegativeArgumentException - if the given initialCapacity is negative.
    • addAtEnd

      public void addAtEnd(E element, E... elements)
      The time complexity of this implementation is O(n+m) when the current ArrayList contains n elements and m elements are given. Adds the given given elements at the end of the current IArrayList. The elements will be added in the given order.
      Angegeben von:
      addAtEnd in Schnittstelle IArrayList<E>
      Parameter:
      element -
      elements -
    • addAtEnd

      public void addAtEnd(E[] elements)
      The time complexity of this implementation is O(n+m) when the current ArrayList contains n elements and m elements are given. Adds the given elements at the end of the current IArrayList. The elements will be added in the given order.
      Angegeben von:
      addAtEnd in Schnittstelle IArrayList<E>
      Parameter:
      elements -
    • clear

      public void clear()
      The time complexity of this implementation is O(1). Removes the elements of the current Clearable.
      Angegeben von:
      clear in Schnittstelle Clearable
    • getCopy

      public IArrayList<E> getCopy()
      The time complexity of this implementation is O(n) when the current ArrayList contains n elements.
      Angegeben von:
      getCopy in Schnittstelle Copyable<E>
      Gibt zurück:
      a copy of the current Copyable.
    • getCount

      public int getCount()
      The time complexity of this implementation is O(1).
      Angegeben von:
      getCount in Schnittstelle ICountingContainer<E>
      Gibt zurück:
      the number of elements of the current ICountingContainer.
    • getStoredAt1BasedIndex

      public E getStoredAt1BasedIndex(int param1BasedIndex)
      The time complexity of this implementation is O(1).
      Angegeben von:
      getStoredAt1BasedIndex in Schnittstelle SingleSearchable<E>
      Parameter:
      param1BasedIndex -
      Gibt zurück:
      the element at the given param1BasedIndex. The element can be null.
    • isMaterialized

      public boolean isMaterialized()
      The time complexity of this implementation is O(1).
      Angegeben von:
      isMaterialized in Schnittstelle MaterializationRequestable
      Gibt zurück:
      true if the current MaterializationRequestable is materialized, false otherwise.
    • iterator

      public CopyableIterator<E> iterator()
      The time complexity of this implementation is O(1).
      Angegeben von:
      iterator in Schnittstelle Iterable<E>
      Angegeben von:
      iterator in Schnittstelle IterableWithCopyableIterator<E>
    • toOrderedList

      public <C extends Comparable<C>> IContainer<E> toOrderedList(Function<E,C> norm)
      This implementation uses the merge sort algorithm. The complexity of this implementation is O(n*log(n)) if the current ArrayList contains n elements.
      Angegeben von:
      toOrderedList in Schnittstelle IContainer<E>
      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()
      The time complexity of this implementation is O(n) if the current ArrayList contains n elements.
      Setzt außer Kraft:
      toString in Klasse Object
    • createEmptyMutableList

      protected <E2> ILinkedList<E2> createEmptyMutableList(Marker<E2> marker)
      The time complexity of this implementation is O(1).
      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.