LinkedList
class in package klyn.collections

    public class LinkedList<T> extends Object implements List<T>:

Object
└ LinkedList
All Implemented Interfaces: List

Ordered list with the full `List<T>` API.

The current runtime uses the same optimized contiguous native storage as `ArrayList<T>`. This keeps iteration, indexing and sorting cache-friendly while preserving the semantic contract of an ordered mutable list.

Properties

Modifier and Type | Member | Description
--- | --- | ---
public override readonly native property | size `size as ULong` | Number of elements in the list.

Inherited Properties
property Inherited Properties from Object: type
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | LinkedList `LinkedList():` | Creates an empty list.
public | LinkedList `LinkedList(collection as Collection<T>):` | Creates a list from a collection.
public | LinkedList `LinkedList(list as IList<T>):` | Creates a list from a read-only list.
public | LinkedList `LinkedList(source as Set<T>):` | Creates a list from a set.
public | LinkedList `LinkedList(tuple as Tuple):` | Creates a list from a tuple.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public native | add `add(index as Int, item as T) as Void` | Inserts an element at the requested index.
public native | add `add(item as T) as Void` | Adds an element at the end.
public native | addAll `addAll(index as Int, values as IList<T>) as Void` | Inserts every element from a read-only list at the requested index.
public native | addAll `addAll(index as Int, values as Set<T>) as Void` | Inserts every element from a set at the requested index.
public native | addAll `addAll(index as Int, values as Tuple) as Void` | Inserts every element from a tuple at the requested index.
public native | addAll `addAll(values as IList<T>) as Void` | Appends every element from a read-only list.
public native | addAll `addAll(values as Set<T>) as Void` | Appends every element from a set.
public native | addAll `addAll(values as Tuple) as Void` | Appends every element from a tuple.
public native | clear `clear() as Void` | Removes all elements.
public native | count `count(item as T) as ULong` | Counts occurrences of the given element in the list.
public native | indexOf `indexOf(item as T, start as Int = 0) as Int` | Returns the first index of the given element.
public native | join `join(separator as String) as String` | Joins elements into a string using the separator.
public native | lastIndexOf `lastIndexOf(item as T, start as Int = -1) as Int` | Returns the last index of the given element.
public native | remove `remove(item as T) as Boolean` | Removes the first matching element.
public native | removeAt `removeAt(index as Int) as Void` | Removes the element at the requested index.
public native | reverse `reverse() as Void` | Reverses list elements in-place.
public native | reverseNew `reverseNew() as LinkedList<T>` | Returns a new reversed list without modifying this list.
public native | shuffle `shuffle() as Void` | Randomly shuffles the list in-place.
public native | sort `sort() as Void` | Sorts the list in ascending order.
public native | sortNew `sortNew() as LinkedList<T>` | Returns a sorted LinkedList without modifying this list.
public native | toString `toString() as String` | Returns a string representation of the list.

Inherited Methods
method Inherited Methods from Object: deepCopy, fromJson, toDict, toJson, toXml
method Inherited Methods from List: add, add, addAll, addAll, addAll, addAll, addAll, addAll, remove, removeAt, reverse, reverseNew, shuffle, sort, sortNew
method Inherited Methods from Collection: count, toString
Operators

Modifier and Type | Member | Description
--- | --- | ---
public native | operator in(item as T) as Boolean | Returns true if the list contains the given element.
public native static | operator+(readonly notnull left as LinkedList<T>, readonly notnull right as LinkedList<T>) as LinkedList<T> | Concatenates two LinkedList instances into a new LinkedList.
public native | operator+=(values as IList<T>) as Void | Appends every element from a read-only list.
public native | operator+=(values as Set<T>) as Void | Appends every element from a set.
public native | operator+=(values as Tuple) as Void | Appends every element from a tuple.
public native | operator[](index as Int) as T | Gets the element at the given index.

Inherited Operators
operator Inherited Operators from List: operator+(left as List<T>, right as List<T>) as List<T>, operator+=(values as IList<T>) as Void, operator+=(values as Set<T>) as Void, operator+=(values as Tuple) as Void
operator Inherited Operators from Collection: operator in(item as T) as Boolean