public class HashSetSync<T> extends Object implements Set<T>:
Thread-safe hash set implementation.
HashSetSync<T> exposes the same public API as HashSet<T> while the native runtime serializes each operation on the instance storage. Average add, lookup and remove remain O(1), with only the expected lock overhead for shared mutable access.
@param <T> Element type. @since 1.0
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly native property | sizesize as ULong |
Number of elements in the set. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | HashSetSyncHashSetSync(): |
Creates an empty synchronized hash set. |
| public | HashSetSyncHashSetSync(collection as Collection<T>): |
Creates a synchronized hash set from a collection. |
| public | HashSetSyncHashSetSync(list as IList<T>): |
Creates a synchronized hash set from a read-only list. |
| public | HashSetSyncHashSetSync(source as HashSet<T>): |
Creates a synchronized hash set from a regular hash set. |
| public | HashSetSyncHashSetSync(source as HashSetSync<T>): |
Creates a synchronized hash set from another synchronized hash set. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | _items_items() as ArrayList<T> |
No summary. |
| public native | addadd(item as T) as Void |
Adds an element to the set. |
| public native | clearclear() as Void |
Clears all elements. |
| public native | countcount(item as T) as ULong |
Counts occurrences of the given element in the set. |
| public native | removeremove(item as T) as Boolean |
Removes an element from the set. |
| public native | toStringtoString() as String |
Returns a string representation of the set. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | operator in(item as T) as Boolean | Returns true if the set contains the element. |