Class ArrayList<E>
java.lang.Object
ch.nolix.base.datastructure.extendediterable.AbstractExtendedIterable<E>
ch.nolix.base.datastructure.arraylist.ArrayList<E>
- Type Parameters:
E- the type of the elements of aArrayList.
- All Implemented Interfaces:
ArrayMappable<E>, IndexRequestable<E>, IterableWithCopyableIterator<E>, SingleSearchable<E>, StoringRequestable<E>, StringMappable, ExtendedIterable<E>, Filterable<E>, FilteringContainerViewProvider<E>, Groupable<E>, IntervallContainerViewProvider<E>, Mappable<E>, MappingContainerViewProvider<E>, AggregationRequestable<E>, CountRequestable<E>, IAppendableList<E>, IArrayList<E>, Copyable<IArrayList<E>>, Clearable, EmptinessRequestable, MaterializationRequestable, Iterable<E>
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionvoidThe time complexity of this implementation is O(n) when the currentArrayListcontains n elements.voidThe time complexity of this implementation is O(n+m) when the currentArrayListcontains n elements and m elements are given.<T extends E>
voidaddAtEnd(T... elements) The time complexity of this implementation is O(n+m) when the currentArrayListcontains n elements and m elements are given.voidclear()The time complexity of this implementation is O(1).static <T> ArrayList<T> getCopy()The time complexity of this implementation is O(n) when the currentArrayListcontains n elements.intgetCount()The time complexity of this implementation is O(1).getStoredAtOneBasedIndex(int oneBasedIndex) The time complexity of this implementation is O(1).voidinsertAtOneBasedIndex(int oneBasedIndex, E element) booleanThe time complexity of this implementation is O(1).iterator()The time complexity of this implementation is O(1).toString()The time complexity of this implementation is O(n) if the currentArrayListcontains n elements.static <T> ArrayList<T> withElements(T... elements) The time complexity of this implementation is O(n) when n elements are given.static <T> ArrayList<T> withInitialCapacity(int initialCapacity) The time complexity of this implementation is O(1).static <T> ArrayList<T> withInitialCapacityFromSizeOfContainer(CountRequestable<?> container) The time complexity of this implementation is O(1).Methods inherited from class AbstractExtendedIterable
contains, containsAllOf, containsAllOf, containsAny, containsAnyOf, containsAnyOf, containsAsManyAs, containsEqualing, containsExactlyEqualingInSameOrder, containsExactlyInSameOrder, containsLessThan, containsMoreThan, containsNone, containsNoneOf, containsNoneOf, containsOnce, containsOne, containsOne, containsOneEqualing, containsOnly, getAverage, getAverageOrZero, getCount, getCountOf, getMax, getMaxOrZero, getMedian, getMedianOrZero, getMin, getMinOrZero, getOneBasedIndexOfFirst, getOneBasedIndexOfFirstEqualElement, getOneBasedIndexOfFirstOccurrenceOf, getOptionalStoredFirst, getOptionalStoredFirst, getStandardDeviation, getStoredByMax, getStoredByMin, getStoredFirst, getStoredFirst, getStoredFirstOfType, getStoredInGroups, getStoredLast, getStoredOfType, getStoredOne, getStoredOne, getStoredOthers, getStoredSelected, getSum, getSumOfInts, getVariance, getViewFromOneBasedStartIndex, getViewFromOneBasedStartIndexToOneBasedEndIndex, getViewOf, getViewOfStoredSelected, getViewToOneBasedEndIndex, getViewWithoutFirst, getViewWithoutFirst, getViewWithoutLast, getViewWithoutLast, isEmpty, to, toArray, toByteArray, toCharArray, toConcatenatedString, toDoubleArray, toIntArray, toLongArray, toMultiples, toNumbers, toOrderedList, toReversedList, toStringArray, toStrings, toStringWithSeparator, toStringWithSeparator, toWithOneBasedIndexMethods inherited from interface AggregationRequestable
getAverage, getAverageOrZero, getMax, getMaxOrZero, getMedian, getMedianOrZero, getMin, getMinOrZero, getStandardDeviation, getSum, getSumOfInts, getVarianceMethods inherited from interface ArrayMappable
toArray, toByteArray, toCharArray, toDoubleArray, toIntArray, toLongArray, toStringArrayMethods inherited from interface CountRequestable
getCount, getCountOfMethods inherited from interface EmptinessRequestable
containsAny, isEmptyMethods inherited from interface ExtendedIterable
toOrderedList, toReversedListMethods inherited from interface Filterable
getStoredOfType, getStoredOthers, getStoredSelectedMethods inherited from interface FilteringContainerViewProvider
getViewOfStoredSelectedMethods inherited from interface Groupable
getStoredInGroupsMethods inherited from interface IndexRequestable
getOneBasedIndexOfFirst, getOneBasedIndexOfFirstEqualElement, getOneBasedIndexOfFirstOccurrenceOfMethods inherited from interface IntervallContainerViewProvider
getViewFromOneBasedStartIndex, getViewFromOneBasedStartIndexToOneBasedEndIndex, getViewToOneBasedEndIndex, getViewWithoutFirst, getViewWithoutFirst, getViewWithoutLast, getViewWithoutLastMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Mappable
to, toMultiples, toNumbers, toStrings, toWithOneBasedIndexMethods inherited from interface MappingContainerViewProvider
getViewOfMethods inherited from interface MaterializationRequestable
isViewMethods inherited from interface SingleSearchable
getOptionalStoredFirst, getOptionalStoredFirst, getStoredByMax, getStoredByMin, getStoredFirst, getStoredFirst, getStoredFirstOfType, getStoredLast, getStoredOne, getStoredOneMethods inherited from interface StoringRequestable
contains, containsAllOf, containsAllOf, containsAny, containsAnyOf, containsAnyOf, containsAsManyAs, containsEqualing, containsExactlyEqualingInSameOrder, containsExactlyInSameOrder, containsLessThan, containsMoreThan, containsNone, containsNoneOf, containsNoneOf, containsOnce, containsOne, containsOne, containsOneEqualing, containsOnlyMethods inherited from interface StringMappable
toConcatenatedString, toStringWithSeparator, toStringWithSeparator
-
Method Details
-
createEmpty
-
withElements
The time complexity of this implementation is O(n) when n elements are given.- Type Parameters:
T- is the type of the given elements.- Parameters:
elements-- Returns:
- a new
ArrayListwith the given elements. - Throws:
RuntimeException- if the given elements is nullRuntimeException- if one of the given elements is null.
-
withInitialCapacity
The time complexity of this implementation is O(1).- Type Parameters:
T- is the type of the elements of the createdArrayList.- Parameters:
initialCapacity-- Returns:
- a new
ArrayListwith the given initialCapacity - Throws:
RuntimeException- if the given initialCapacity is negative.
-
withInitialCapacityFromSizeOfContainer
public static <T> ArrayList<T> withInitialCapacityFromSizeOfContainer(CountRequestable<?> container) The time complexity of this implementation is O(1).- Type Parameters:
T- is the type of the elements of the createdArrayList.- Parameters:
container-- Returns:
- a new
ArrayListwith a initialCapacity that is the size of the given container. - Throws:
NullPointerException- if the given container is null.
-
addAtEnd
The time complexity of this implementation is O(n) when the currentArrayListcontains n elements. Adds the given element at the end of the currentIAppendableList.- Specified by:
addAtEndin interfaceIAppendableList<E>- Parameters:
element-
-
addAtEnd
The time complexity of this implementation is O(n+m) when the currentArrayListcontains n elements and m elements are given. Adds the given elements at the end of the currentIAppendableList. The elements will be added in the given order.- Specified by:
addAtEndin interfaceIAppendableList<E>- Parameters:
elements-
-
addAtEnd
The time complexity of this implementation is O(n+m) when the currentArrayListcontains n elements and m elements are given. Adds the given elements at the end of the currentIAppendableList. The elements will be added in the given order.- Specified by:
addAtEndin interfaceIAppendableList<E>- Type Parameters:
T- the type of the given elements- Parameters:
elements-
-
clear
-
getCopy
-
getCount
public int getCount()The time complexity of this implementation is O(1).- Specified by:
getCountin interfaceCountRequestable<E>- Returns:
- the number of elements of the current
CountRequestable.
-
getStoredAtOneBasedIndex
The time complexity of this implementation is O(1).- Specified by:
getStoredAtOneBasedIndexin interfaceSingleSearchable<E>- Parameters:
oneBasedIndex-- Returns:
- the element at the given oneBasedIndex. The element can be null.
-
insertAtOneBasedIndex
The time complexity of this implementation is O(n) if the given oneBasedIndex is bigger than the number of the elements of the currentArrayListand the currentArrayListcontains n elements. The time complexity of this implementation is O(1) if the given oneBasedIndex is not bigger than the number of the elements of the currentArrayList. Adds the given element at the given oneBasedIndex- Specified by:
insertAtOneBasedIndexin interfaceIArrayList<E>- Parameters:
oneBasedIndex-element-
-
isMaterialized
public boolean isMaterialized()The time complexity of this implementation is O(1).- Specified by:
isMaterializedin interfaceMaterializationRequestable- Returns:
- true if the current
MaterializationRequestableis materialized, false otherwise.
-
iterator
The time complexity of this implementation is O(1). -
toString
-