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]

@param <T> Element type. @since 1.0

Properties

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

Properties inherited from Object: type
Properties inherited 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 | join `join(separator as String) as String` | Joins elements into a string using the separator.
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.

Methods inherited from Object: fromJson, toDict, toJson, toString, toXml
Methods inherited from IList: count, join
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, 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.

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