Package org.polyfrost.polyui.utils
Class LinkedList
-
- All Implemented Interfaces:
-
kotlin.collections.Collection,kotlin.collections.Iterable,kotlin.collections.List,kotlin.collections.MutableCollection,kotlin.collections.MutableIterable,kotlin.collections.MutableList
public final class LinkedList<T extends Object> implements List<T>
Implementation of the MutableList interface for PolyUI.
This is a minor-ly modified version of java.util.LinkedList, with "fast" methods:
fastRemoveIfReversed these methods are all designed to avoid the allocation of an Iterator object, as otherwise PolyUI would create a lot of garbage.
Being a LinkedList, the random get and put operations are not the best. However, this operation is rare in PolyUI, so it's okay to use this.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classLinkedList.Node
-
Field Summary
Fields Modifier and Type Field Description private final LinkedList.Node<T>startprivate final LinkedList.Node<T>endprivate final Integersize
-
Constructor Summary
Constructors Constructor Description LinkedList(Collection<T> elements)LinkedList(T elements)LinkedList()
-
Method Summary
-
Methods inherited from class kotlin.collections.Iterable
forEach -
Methods inherited from class kotlin.collections.Collection
parallelStream, stream, toArray -
Methods inherited from class kotlin.collections.MutableCollection
removeIf -
Methods inherited from class kotlin.collections.MutableList
replaceAll, sort -
Methods inherited from class kotlin.collections.List
spliterator -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
LinkedList
LinkedList(Collection<T> elements)
-
LinkedList
LinkedList(T elements)
-
LinkedList
LinkedList()
-
-
Method Detail
-
getStart
final LinkedList.Node<T> getStart()
-
getEnd
final LinkedList.Node<T> getEnd()
-
addAll
Boolean addAll(Integer index, Collection<T> elements)
-
addAll
Boolean addAll(Collection<T> elements)
-
iterator
@Deprecated(message = "This list is designed around not using this method.", level = DeprecationLevel.ERROR) Iterator<T> iterator()
-
listIterator
@Deprecated(message = "Not implemented", level = DeprecationLevel.ERROR) ListIterator<T> listIterator()
-
listIterator
@Deprecated(message = "Not implemented", level = DeprecationLevel.ERROR) ListIterator<T> listIterator(Integer index)
-
lastIndexOf
Integer lastIndexOf(T element)
-
retainAll
Boolean retainAll(Collection<T> elements)
-
removeAll
Boolean removeAll(Collection<T> elements)
-
containsAll
Boolean containsAll(Collection<T> elements)
-
fastEachIndexed
final Unit fastEachIndexed(Function2<Integer, T, Unit> action)
-
fastEachReversed
final Unit fastEachReversed(Function1<T, Unit> action)
-
fastRemoveIf
final Boolean fastRemoveIf(Function1<T, Boolean> predicate)
-
fastRemoveIfIndexed
final Boolean fastRemoveIfIndexed(Function2<Integer, T, Boolean> predicate)
-
fastRemoveIfReversed
final Boolean fastRemoveIfReversed(Function1<T, Boolean> predicate)
-
addOrReplace
final T addOrReplace(T element)
-
_remove
@ApiStatus.Internal() final Unit _remove(LinkedList.Node<T> node)
-
allAre
final Boolean allAre(Function1<T, Boolean> predicate)
Returns
trueif all elements match the given predicate.Note this function will return
trueif the list is empty, according to the principle of Vacuous truth, and the fact that there are no elements that don't match the given predicate.
-
-
-
-