public class ArraySync<T> extends Object implements IList<T>:
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
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly native property | sizesize as ULong |
Number of elements in the array. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | ArraySync | Creates a fixed-size synchronized array. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | countcount(item as T) as ULong |
Counts occurrences of the given element. |
| public native | join | Joins elements into a string using the separator. |
| public native | reversereverse() as Void |
Reverses array elements in-place while keeping the fixed size. |
| public native | reverseNewreverseNew() as ArraySync<T> |
Returns a reversed synchronized array copy. |
| public native | sortsort() as Void |
Sorts array elements in-place while keeping the fixed size. |
| public native | sortNewsortNew() as ArraySync<T> |
Returns a sorted synchronized array copy. |
| public native override | toStringtoString() as String |
Returns the fixed synchronized-array textual representation. |
| 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. |