ArraySync
class in package klyn.collections

    public class ArraySync<T> extends Object implements IList<T>:

Object
└ ArraySync
All Implemented Interfaces: IList

Thread-safe fixed-size array.

`ArraySync<T>` exposes the same fixed-size API as `Array<T>` while native storage protects individual operations with its internal mutex.

    import klyn.collections

    data = fs:[10, 20, 30]
    data[0] = 40
    print(data)       # fs:[40, 20, 30]

Properties

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

Inherited Properties
property Inherited Properties from Object: type
property Inherited Properties from IList: size
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public native | ArraySync `ArraySync(size as Int)` | Creates a fixed-size synchronized array.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public native | count `count(item as T) as ULong` | Counts occurrences of the given element.
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 | reverse `reverse() as Void` | Reverses array elements in-place while keeping the fixed size.
public native | reverseNew `reverseNew() as ArraySync<T>` | Returns a reversed synchronized array copy.
public native | sort `sort() as Void` | Sorts array elements in-place while keeping the fixed size.
public native | sortNew `sortNew() as ArraySync<T>` | Returns a sorted synchronized array copy.
public native override | toString `toString() as String` | Returns the fixed synchronized-array textual representation.

Inherited Methods
method Inherited Methods from Object: deepCopy, fromJson, toDict, toJson, toString, toXml
method Inherited Methods from IList: count, indexOf, join, lastIndexOf
Operators

Modifier and Type | Member | Description
--- | --- | ---
public native | operator in(item as T) as Boolean | Returns true if the array contains the given element.
public native static | operator!=(readonly notnull left as ArraySync, readonly notnull right as ArraySync) as Boolean | Compares two synchronized arrays structurally for inequality.
public native static | operator+(readonly notnull left as ArraySync<T>, readonly notnull right as ArraySync<T>) as ArraySync<T> | Concatenates two synchronized fixed arrays into a new synchronized fixed array.
public native static | operator==(readonly notnull left as ArraySync, readonly notnull right as ArraySync) as Boolean | Compares two synchronized arrays structurally.
public native | operator[](index as Int) as T | Returns or replaces the element at the given index.

Inherited Operators
operator Inherited Operators from IList: operator in(item as T) as Boolean, operator[](index as Int) as T