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>, IMappableContainer<E>, ISearchableContainer<E>, IStatisticalConainer<E>, IterableWithCopyableIterator<E>, StoringRequestable<E>, 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
  • Konstruktordetails

    • ArrayList

      public ArrayList()
  • Methodendetails

    • 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 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 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 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 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 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 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 complexity of this implementation is O(1).
      Angegeben von:
      getCount in Schnittstelle IStatisticalConainer<E>
      Gibt zurück:
      the number of elements of the current IStatisticalConainer.
    • getStoredAt1BasedIndex

      public E getStoredAt1BasedIndex(int param1BasedIndex)
      The complexity of this implementation is O(1).
      Angegeben von:
      getStoredAt1BasedIndex in Schnittstelle ISearchableContainer<E>
      Parameter:
      param1BasedIndex -
      Gibt zurück:
      the element at the given p1BasedIndex.
    • getStoredLast

      public E getStoredLast()
      The complexity of this implementation is O(1).
      Angegeben von:
      getStoredLast in Schnittstelle ISearchableContainer<E>
      Gibt zurück:
      the last element of the current ISearchableContainer.
    • isMaterialized

      public boolean isMaterialized()
      The 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 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 norm 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 given norm.
    • toString

      public String toString()
      The 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 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.