ImmutableList
classin packageklyn.collections
public class ImmutableList<T> extends Object implements IList<T>
└ ImmutableList
All Implemented Interfaces: IList

Immutable homogeneous ordered collection.

Element replacement, slice assignment and indexed increments/decrements are rejected at compilation with TypeError. Immutability applies to the list's structure, not to mutable objects stored in it.

values as IList<Int> = i:[10, 20, 30]
print(values[1])   # 20
Properties
Modifier and Type Member Description
public override readonly native property size
size as ULong
Number of elements in this list.
Inherited Properties
propertyInherited Properties from Object: type
propertyInherited Properties from IList: size
Constructors
Modifier and Type Member Description
public native ImmutableList
ImmutableList(values as IList<T> = [])
Builds an immutable list by copying the provided read-only list.
Methods
Modifier and Type Member Description
public override count
count(item as T) as ULong
Counts occurrences of the given value.
public native indexOf
indexOf(item as T, start as Long = 0) as Long
Returns the first index of the given value.
public override join
join(separator as String) as String
Joins list values with a separator.
public native lastIndexOf
lastIndexOf(item as T, start as Long = -1) as Long
Returns the last index of the given value.
public native sortNew
sortNew() as ImmutableList<T>
Returns a sorted immutable copy of this list.
public native override toString
toString() as String
Returns a normalized textual representation using the immutable literal syntax.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toMap, toString, toXml
methodInherited Methods from IList: count, indexOf, join, lastIndexOf
Operators
Modifier and Type Member Description
public override operator in(item as T) as Boolean Returns true when the list contains the given value.
public override native operator[](index as Long) as T Returns the value at the given index.
Inherited Operators
operatorInherited Operators from IList: operator in(item as T) as Boolean, operator[](index as Long) as T