public class ArrayListSync<T> extends Object implements List<T>:
Thread-safe resizable array list.
ArrayListSync<T> exposes the same typed API as ArrayList<T> while the native runtime serializes each operation on the instance storage. It keeps the public contract fully generic: elements are accepted and returned as T, not as Object.
Use this class when several threads can mutate or read the same list. For single-threaded hot paths, prefer ArrayList<T> to avoid locking cost.
Native operator mapping:
operator[] is mapped to the array-list native runtime using synchronized storage.@param <T> Element type. @since 1.0
| Modifier and Type | Member | Description |
|---|---|---|
| public override readonly native property | sizesize as ULong |
Number of elements in the list. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | ArrayListSync | Creates an empty synchronized list. |
| public | ArrayListSyncArrayListSync(collection as Collection<T>): |
Creates a synchronized list from a collection. |
| public | ArrayListSyncArrayListSync(list as IList<T>): |
Creates a synchronized list from a read-only list. |
| public | ArrayListSyncArrayListSync(source as Set<T>): |
Creates a synchronized list from a set. |
| public | ArrayListSyncArrayListSync(tuple as Tuple): |
Creates a synchronized list from a tuple. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | addadd(item as T) as Void |
Adds an element at the end. |
| public native | clearclear() as Void |
Removes all elements. |
| public native | countcount(item as T) as ULong |
Counts occurrences of the given element in the list. |
| public native | join | Joins elements into a single string using the separator. |
| public native | removeremove(item as T) as Boolean |
Removes the first matching element. |
| public native | reversereverse() as Void |
Reverses list elements in-place. |
| public native | reverseNewreverseNew() as List<T> |
Returns a new reversed list without modifying the original. |
| public native | sortsort() as Void |
Sorts the list in ascending order. |
| public native | sortNewsortNew() as List<T> |
Returns a new sorted list without modifying the original. |
| public native | toStringtoString() as String |
Returns a string representation of the list. |
| 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. |