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.
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 | differencedifference(other as HashSetSync<T>) as HashSetSync<T>: |
Returns a new synchronized set containing elements from this set that are absent from other. |
| public | intersectionintersection(other as HashSetSync<T>) as HashSetSync<T>: |
Returns a new synchronized set containing elements present in both sets. |
| public | isSubsetOfisSubsetOf(other as HashSetSync<T>) as Boolean: |
Returns true when every element of this set is present in other. |
| public | isSupersetOfisSupersetOf(other as HashSetSync<T>) as Boolean: |
Returns true when this set contains every element of other. |
| public native | removeremove(item as T) as Boolean |
Removes an element from the set. |
| public | symmetricDifferencesymmetricDifference(other as HashSetSync<T>) as HashSetSync<T>: |
Returns a new synchronized set containing elements present in exactly one of the two sets. |
| public native | toStringtoString() as String |
Returns a string representation of the set. |
| public | unionunion(other as HashSetSync<T>) as HashSetSync<T>: |
Returns a new synchronized set containing all elements from this set and other. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | operator in(item as T) as Boolean | Returns true if the set contains the element. |