T - the type of elements maintained by this Collectionpublic class ObjectLinkedList<T> extends AbstractObjectList<T> implements ObjectPriorityDequeue<T>, Stack<T>
This implementation is optimized to improve how data is processed with interfaces like Stack
and with optimized functions that use type-specific implementations for primitives and optimized logic for bulk actions.
| Constructor and Description |
|---|
ObjectLinkedList()
Creates a new LinkedList.
|
ObjectLinkedList(java.util.Collection<? extends T> c)
Deprecated.
|
ObjectLinkedList(ObjectCollection<T> c)
Creates a new LinkedList a copy with the contents of the Collection.
|
ObjectLinkedList(ObjectList<T> l)
Creates a new LinkedList a copy with the contents of the List.
|
ObjectLinkedList(T... a)
Creates a new LinkedList with a Copy of the array
|
ObjectLinkedList(T[] a,
int length)
Creates a new LinkedList with a Copy of the array with a custom length
|
ObjectLinkedList(T[] a,
int offset,
int length)
Creates a new LinkedList with a 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()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
java.util.Comparator<T> |
comparator() |
boolean |
contains(java.lang.Object e) |
ObjectLinkedList<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.
|
T |
dequeue()
Method to extract a element from the PriorityQueue
|
T |
dequeueLast()
A Method to remove a element from the last place instead of the first
|
void |
enqueue(T e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirst(T e)
Method to insert a element into the first Index instead of the last.
|
<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.
|
T |
first()
Shows the element that is to be returned next
|
void |
forEach(java.util.function.Consumer<? super T> action) |
<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) |
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)
The IndexOf implementation iterates over all elements and compares them to the search value.
|
T |
last()
Peeking function for the last element
|
int |
lastIndexOf(java.lang.Object o)
The lastIndexOf implementation iterates over all elements and compares them to the search value.
|
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.
|
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
T |
peek(int index)
Peeking function to see whats inside the queue.
|
T |
pop()
Removes the Object on top of the stack.
|
void |
push(T e)
Inserts a given Object on top of the stack
|
<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 |
remove(java.lang.Object e) |
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 |
removeFirst(T e)
Removes the first found element in the queue
|
boolean |
removeIf(java.util.function.Predicate<? super T> filter) |
boolean |
removeLast(T e)
Removes the last found element in the queue
|
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()
Provides the amount of elements currently in the stack
|
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.
|
boolean |
swapRemove(T e)
A Highly Optimized remove function that removes the desired element.
|
java.lang.Object[] |
toArray()
A method to drop the contents of the Queue without clearing the queue
|
<E> E[] |
toArray(E[] a)
A method to drop the contents of the Queue without clearing the queue
|
T[] |
toArray(Int2ObjectFunction<T[]> action)
A Helper function that simplifies the process of creating a new Array.
|
addAll, addAll, addAll, equals, hashCode, iterator, listIterator, size, subListcontainsAll, containsAll, containsAny, containsAnyenqueueAllFirst, enqueueAllFirst, enqueueAllFirst, enqueueAllFirst, enqueueAllFirst, synchronizeQueue, synchronizeQueueenqueueAll, enqueueAll, enqueueAll, enqueueAll, enqueueAll, isEmpty, iteratorarrayflatMap, asAsync, distinct, filter, flatMap, limit, map, peek, pour, pourAsList, pourAsSet, sortedaddElements, addElements, addIfAbsent, addIfPresent, getElements, sort, synchronize, synchronize, unmodifiable, unstableSortaddAll, addAll, containsAll, containsAny, containsAny, pourpublic ObjectLinkedList()
@Deprecated public ObjectLinkedList(java.util.Collection<? extends T> c)
c - the elements that should be added into the listpublic ObjectLinkedList(ObjectCollection<T> c)
c - the elements that should be added into the listpublic ObjectLinkedList(ObjectList<T> l)
l - the elements that should be added into the listpublic ObjectLinkedList(T... a)
a - the array that should be copiedpublic ObjectLinkedList(T[] a, int length)
a - the array that should be copiedlength - the desired length that should be copiedpublic ObjectLinkedList(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 boolean addAll(int index,
ObjectCollection<T> c)
ObjectListaddAll in interface ObjectList<T>index - 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)
ObjectListaddAll in interface ObjectList<T>index - index at which the specified elements is to be insertedc - the elements that need to be addedpublic boolean addAll(int index,
java.util.Collection<? extends T> c)
addAll in interface java.util.List<T>public void enqueue(T e)
ObjectPriorityQueueenqueue in interface ObjectPriorityQueue<T>e - the element that should be insertedpublic void enqueueFirst(T e)
ObjectPriorityDequeueenqueueFirst in interface ObjectPriorityDequeue<T>e - the element that should be inserted into the first placepublic void push(T e)
Stackpublic boolean addAll(T[] e, int offset, int length)
ObjectCollectionaddAll in interface ObjectCollection<T>e - 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)
ObjectListaddElements in interface ObjectList<T>from - 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)
ObjectListgetElements in interface ObjectList<T>from - 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 T first()
ObjectPriorityQueuefirst in interface ObjectPriorityQueue<T>public T last()
ObjectPriorityDequeuelast in interface ObjectPriorityDequeue<T>public T peek(int index)
ObjectPriorityQueuepublic boolean contains(java.lang.Object e)
public int indexOf(java.lang.Object o)
AbstractObjectListindexOf in interface java.util.List<T>indexOf in class AbstractObjectList<T>o - the value that the index is searched for.public int lastIndexOf(java.lang.Object o)
AbstractObjectListlastIndexOf in interface java.util.List<T>lastIndexOf in class AbstractObjectList<T>o - the value that the index is searched for.public 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 ObjectSplititerator<T> spliterator()
spliterator in interface java.lang.Iterable<T>spliterator in interface java.util.Collection<T>spliterator in interface java.util.List<T>spliterator in interface ObjectCollection<T>spliterator in interface ObjectIterable<T>spliterator in interface ObjectList<T>public void forEach(java.util.function.Consumer<? super T> action)
forEach in interface java.lang.Iterable<T>public <E> void forEach(E input,
ObjectObjectConsumer<E,T> action)
ObjectIterableforEach in interface ObjectIterable<T>E - 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)
ObjectIterablematchesAny in interface ObjectIterable<T>filter - that should be appliedpublic boolean matchesNone(Object2BooleanFunction<T> filter)
ObjectIterablematchesNone in interface ObjectIterable<T>filter - that should be appliedpublic boolean matchesAll(Object2BooleanFunction<T> filter)
ObjectIterablematchesAll in interface ObjectIterable<T>filter - that should be appliedpublic T findFirst(Object2BooleanFunction<T> filter)
ObjectIterablefindFirst in interface ObjectIterable<T>filter - that should be appliedpublic <E> E reduce(E identity,
java.util.function.BiFunction<E,T,E> operator)
ObjectIterablereduce in interface ObjectIterable<T>E - the type of elements maintained by this Collectionidentity - the start valueoperator - the operation that should be appliedpublic T reduce(ObjectObjectUnaryOperator<T,T> operator)
ObjectIterablereduce in interface ObjectIterable<T>operator - the operation that should be appliedpublic int count(Object2BooleanFunction<T> filter)
ObjectIterablecount in interface ObjectIterable<T>filter - that should be appliedpublic void replaceAll(java.util.function.UnaryOperator<T> o)
ObjectListreplaceAll in interface java.util.List<T>replaceAll in interface ObjectList<T>o - the action to replace the valuespublic void onChanged()
ObjectPriorityQueueonChanged in interface ObjectPriorityQueue<T>public java.util.Comparator<T> comparator()
comparator in interface ObjectPriorityQueue<T>public T dequeue()
ObjectPriorityQueuedequeue in interface ObjectPriorityQueue<T>public T dequeueLast()
ObjectPriorityDequeuedequeueLast in interface ObjectPriorityDequeue<T>public boolean removeFirst(T e)
ObjectPriorityQueueremoveFirst in interface ObjectPriorityQueue<T>e - the element that should be removedpublic boolean removeLast(T e)
ObjectPriorityQueueremoveLast in interface ObjectPriorityQueue<T>e - the element that should be removedpublic T swapRemove(int index)
ObjectListswapRemove in interface ObjectList<T>index - the index of the element to be removedpublic boolean swapRemove(T e)
ObjectListswapRemove in interface ObjectList<T>swapRemove in class AbstractObjectList<T>e - the element that should be removedpublic boolean remove(java.lang.Object e)
public void removeElements(int from,
int to)
ObjectListremoveElements in interface ObjectList<T>from - 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)
ObjectListextractElements in interface ObjectList<T>K - 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 removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
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 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)
AbstractObjectCollectionretainAll in interface ObjectCollection<T>retainAll in class AbstractObjectCollection<T>c - the elements that should be keptCollection.retainAll(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 boolean removeIf(java.util.function.Predicate<? super T> filter)
removeIf in interface java.util.Collection<T>public java.lang.Object[] toArray()
ObjectPriorityQueuepublic <E> E[] toArray(E[] a)
ObjectPriorityQueuetoArray in interface java.util.Collection<T>toArray in interface java.util.List<T>toArray in interface ObjectPriorityQueue<T>toArray in class java.util.AbstractCollection<T>E - the type of elements maintained by this Collectiona - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created arraypublic T[] toArray(Int2ObjectFunction<T[]> action)
ObjectPriorityQueuetoArray in interface ObjectCollection<T>toArray in interface ObjectPriorityQueue<T>action - the array creation functionCollection.toArray(Object[])public int size()
Stacksize in interface java.util.Collection<T>size in interface java.util.List<T>size in interface ObjectPriorityQueue<T>size in interface Stack<T>size in class java.util.AbstractCollection<T>public void clear()
ObjectPriorityQueuepublic ObjectLinkedList<T> copy()
ObjectCollectioncopy in interface ObjectCollection<T>copy in interface ObjectList<T>copy in interface ObjectPriorityDequeue<T>copy in interface ObjectPriorityQueue<T>copy in class AbstractObjectList<T>