T - the type of elements maintained by this Collectionpublic class ImmutableObjectList<T> extends AbstractObjectList<T>
| Constructor and Description |
|---|
ImmutableObjectList(java.util.Collection<? extends T> c)
Creates a new Immutable copy of the contents of the Collection.
|
ImmutableObjectList(ObjectCollection<T> c)
Creates a new Immutable copy of the contents of the Collection.
|
ImmutableObjectList(ObjectList<T> l)
Creates a new Immutable copy of the contents of the List.
|
ImmutableObjectList(T... a)
Creates a new Immutable copy of the contents of the Array.
|
ImmutableObjectList(T[] a,
int length)
Creates a new ImmutableList copy of the array with a custom length
|
ImmutableObjectList(T[] a,
int offset,
int length)
Creates a new ImmutableList copy of the array with in the custom range.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T e) |
boolean |
add(T e)
A Type-Specific implementation of add function that delegates to
List.add(int, Object) |
boolean |
addAll(int index,
java.util.Collection<? extends T> c) |
boolean |
addAll(int index,
ObjectCollection<T> c)
A Type-Specific addAll Function to reduce (un)boxing
|
boolean |
addAll(int index,
ObjectList<T> c)
A Type-Specific and optimized addAll function that allows a faster transfer of elements
|
boolean |
addAll(T[] e,
int offset,
int length)
A Type-Specific Array based addAll method to reduce the amount of Wrapping
|
void |
addElements(int from,
T[] a,
int offset,
int length)
A function to fast add elements to the list
|
void |
clear() |
boolean |
contains(java.lang.Object o)
A function to find if the Element is present in this list.
|
ImmutableObjectList<T> |
copy()
A Function that does a shallow clone of the Collection itself.
|
int |
count(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
<K> K[] |
extractElements(int from,
int to,
java.lang.Class<K> type)
A function to fast extract elements out of the list, this removes the elements that were fetched.
|
T |
findFirst(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
void |
forEach(java.util.function.Consumer<? super T> action)
A Type Specific foreach function that reduces (un)boxing
|
<E> void |
forEach(E input,
ObjectObjectConsumer<E,T> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
T |
get(int index)
A Type-Specific get function to reduce (un)boxing
|
T[] |
getElements(int from,
T[] a,
int offset,
int length)
A function to fast fetch elements from the list
|
int |
indexOf(java.lang.Object o)
A function to find the index of a given element
|
int |
lastIndexOf(java.lang.Object o)
A function to find the last index of a given element
|
ObjectListIterator<T> |
listIterator(int index)
A Type-Specific Iterator of listIterator
|
boolean |
matchesAll(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
<E> E |
reduce(E identity,
java.util.function.BiFunction<E,T,E> operator)
Performs a reduction on the
elements of this Iterable
|
T |
reduce(ObjectObjectUnaryOperator<T,T> operator)
Performs a reduction on the
elements of this Iterable
|
T |
remove(int index) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
removeAll(ObjectCollection<T> c)
A Type-Specific implementation of removeAll.
|
boolean |
removeAll(ObjectCollection<T> c,
java.util.function.Consumer<T> r)
A Type-Specific removeAll function that reduces (un)boxing.
|
void |
removeElements(int from,
int to)
a function to fast remove elements from the list.
|
boolean |
removeIf(java.util.function.Predicate<? super T> filter) |
void |
replaceAll(java.util.function.UnaryOperator<T> o)
A function to replace all values in the list
|
boolean |
retainAll(java.util.Collection<?> c) |
boolean |
retainAll(ObjectCollection<T> c)
A Type-Specific implementation of retainAll.
|
boolean |
retainAll(ObjectCollection<T> c,
java.util.function.Consumer<T> r)
A Type-Specific retainAll function that reduces (un)boxing.
|
T |
set(int index,
T e) |
int |
size()
A function to return the size of the list
|
void |
size(int size)
A function to ensure the elements are within the requested size.
|
void |
sort(java.util.Comparator<? super T> c)
Sorts the elements specified by the Natural order either by using the Comparator or the elements
|
ObjectSplititerator<T> |
spliterator()
A Type Specific Type Splititerator to reduce boxing/unboxing
|
T |
swapRemove(int index)
A Highly Optimized remove function that removes the desired element.
|
java.lang.Object[] |
toArray()
A toArray implementation that ensures the Array itself is a Object.
|
<E> E[] |
toArray(E[] a)
A toArray implementation that ensures the Array itself is a Object.
|
void |
unstableSort(java.util.Comparator<? super T> c)
Sorts the elements specified by the Natural order either by using the Comparator or the elements using a unstable sort
|
addAll, addAll, addAll, equals, hashCode, iterator, listIterator, subList, swapRemovecontainsAll, containsAll, containsAny, containsAnyaddElements, addElements, addIfAbsent, addIfPresent, getElements, synchronize, synchronize, unmodifiableaddAll, addAll, containsAll, containsAny, containsAny, pour, toArrayarrayflatMap, asAsync, distinct, filter, flatMap, limit, map, peek, pourAsList, pourAsSet, sortedpublic ImmutableObjectList(java.util.Collection<? extends T> c)
c - the elements that should be added into the listpublic ImmutableObjectList(ObjectCollection<T> c)
c - the elements that should be added into the listpublic ImmutableObjectList(ObjectList<T> l)
l - the elements that should be added into the listpublic ImmutableObjectList(T... a)
a - the array that should be copiedpublic ImmutableObjectList(T[] a, int length)
a - the array that should be copiedlength - the desired length that should be copiedpublic ImmutableObjectList(T[] a, int offset, int length)
a - the array that should be copiedoffset - the starting offset of where the array should be copied fromlength - the desired length that should be copiedjava.lang.IllegalStateException - if offset is smaller then 0java.lang.IllegalStateException - if the offset + length exceeds the array lengthpublic boolean add(T e)
AbstractObjectListList.add(int, Object)add in interface java.util.Collection<T>add in interface java.util.List<T>add in class AbstractObjectList<T>public void add(int index,
T e)
public boolean addAll(int index,
java.util.Collection<? extends T> c)
public boolean addAll(int index,
ObjectCollection<T> c)
ObjectListindex - index at which the specified elements is to be insertedc - the elements that need to be addedList.addAll(int, java.util.Collection)public boolean addAll(int index,
ObjectList<T> c)
ObjectListindex - index at which the specified elements is to be insertedc - the elements that need to be addedpublic boolean addAll(T[] e, int offset, int length)
ObjectCollectione - the elements that should be addedoffset - where to start within the arraylength - how many elements of the array should be addedpublic void addElements(int from,
T[] a,
int offset,
int length)
ObjectListfrom - the index where the elements should be added into the lista - the elements that should be addedoffset - the start index of the array should be read fromlength - how many elements should be read frompublic T[] getElements(int from, T[] a, int offset, int length)
ObjectListfrom - index where the list should be fetching elements froma - the array where the values should be inserted tooffset - the startIndex of where the array should be written tolength - the number of elements the values should be fetched frompublic void removeElements(int from,
int to)
ObjectListfrom - the start index of where the elements should be removed from (inclusive)to - the end index of where the elements should be removed to (exclusive)public <K> K[] extractElements(int from,
int to,
java.lang.Class<K> type)
ObjectListK - the type of elements maintained by this Collectionfrom - the start index of where the elements should be fetched from (inclusive)to - the end index of where the elements should be fetched to (exclusive)type - the type of the OutputArraypublic boolean contains(java.lang.Object o)
public int indexOf(java.lang.Object o)
indexOf in interface java.util.List<T>indexOf in class AbstractObjectList<T>o - the element that is searched forpublic int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<T>lastIndexOf in class AbstractObjectList<T>o - the element that is searched forpublic void sort(java.util.Comparator<? super T> c)
ObjectListList.sort(Comparator)public void unstableSort(java.util.Comparator<? super T> c)
ObjectListc - the sorter of the elements, can be nullList.sort(Comparator)public T get(int index)
index - the index of the element to fetchjava.lang.IndexOutOfBoundsException - if the index is out of rangepublic ImmutableObjectList<T> copy()
ObjectCollectioncopy in interface ObjectCollection<T>copy in interface ObjectList<T>copy in class AbstractObjectList<T>public void forEach(java.util.function.Consumer<? super T> action)
action - The action to be performed for each elementjava.lang.NullPointerException - if the specified action is nullIterable.forEach(java.util.function.Consumer)The default implementation behaves as if:
for(int i = 0;i<size;i++)
action.accept(data[i]);
public <E> void forEach(E input,
ObjectObjectConsumer<E,T> action)
ObjectIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Object2BooleanFunction<T> filter)
ObjectIterablefilter - that should be appliedpublic boolean matchesNone(Object2BooleanFunction<T> filter)
ObjectIterablefilter - that should be appliedpublic boolean matchesAll(Object2BooleanFunction<T> filter)
ObjectIterablefilter - that should be appliedpublic T findFirst(Object2BooleanFunction<T> filter)
ObjectIterablefilter - that should be appliedpublic <E> E reduce(E identity,
java.util.function.BiFunction<E,T,E> operator)
ObjectIterableE - the type of elements maintained by this Collectionidentity - the start valueoperator - the operation that should be appliedpublic T reduce(ObjectObjectUnaryOperator<T,T> operator)
ObjectIterableoperator - the operation that should be appliedpublic int count(Object2BooleanFunction<T> filter)
ObjectIterablefilter - that should be appliedpublic ObjectListIterator<T> listIterator(int index)
ObjectListlistIterator in interface java.util.List<T>listIterator in interface ObjectList<T>listIterator in class AbstractObjectList<T>List.listIterator(int)public void replaceAll(java.util.function.UnaryOperator<T> o)
ObjectListo - the action to replace the valuespublic T remove(int index)
public T swapRemove(int index)
ObjectListindex - the index of the element to be removedpublic boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean removeIf(java.util.function.Predicate<? super T> filter)
public boolean removeAll(ObjectCollection<T> c)
AbstractObjectCollectionremoveAll in interface ObjectCollection<T>removeAll in class AbstractObjectCollection<T>c - the elements that should be deletedCollection.removeAll(Collection)public boolean retainAll(ObjectCollection<T> c)
AbstractObjectCollectionretainAll in interface ObjectCollection<T>retainAll in class AbstractObjectCollection<T>c - the elements that should be keptCollection.retainAll(Collection)public boolean removeAll(ObjectCollection<T> c, java.util.function.Consumer<T> r)
ObjectCollectionremoveAll in interface ObjectCollection<T>removeAll in class AbstractObjectCollection<T>c - the collection of elements that should be removedr - elements that got removedCollection.removeAll(Collection)public boolean retainAll(ObjectCollection<T> c, java.util.function.Consumer<T> r)
ObjectCollectionretainAll in interface ObjectCollection<T>retainAll in class AbstractObjectCollection<T>c - the collection of elements that should be keptr - elements that got removedCollection.retainAll(Collection)public java.lang.Object[] toArray()
public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<T>toArray in interface java.util.List<T>toArray in class java.util.AbstractCollection<T>a - original array. If null a Object array with the right size is created. If to small the Array of the same type is created with the right sizepublic int size()
public void size(int size)
ObjectListsize in interface ObjectList<T>size in class AbstractObjectList<T>size - the requested amount of elements/room for elementspublic void clear()
public ObjectSplititerator<T> spliterator()