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.

@param <T> Element type. @since 1.0

Properties

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

Properties inherited 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(item as T) as Void` | Adds an element at the end.
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 | join `join(separator as String) as String` | Joins elements into a string using the separator.
public native | remove `remove(item as T) as Boolean` | Removes the first matching element.
public native | sort `sort() as Void` | Sorts the list in ascending order.
public native | sortNew `sortNew() as List<T>` | Returns a sorted copy without modifying this list.
public native | toString `toString() as String` | Returns a string representation of the list.

Methods inherited from Object: fromJson, toDict, toJson, toXml
Methods inherited from List: add, remove, reverse, reverseNew, sort, sortNew
Methods inherited 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 | operator[](index as Int) as T | Gets the element at the given index.

Operators inherited from Collection: operator in(item as T) as Boolean