HashSetSync
class in package klyn.collections

    public class HashSetSync<T> extends Object implements Set<T>:

Object
└ HashSetSync
All Implemented Interfaces: Set

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.

Properties

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

Inherited Properties
property Inherited Properties from Object: type
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | HashSetSync `HashSetSync():` | Creates an empty synchronized hash set.
public | HashSetSync `HashSetSync(collection as Collection<T>):` | Creates a synchronized hash set from a collection.
public | HashSetSync `HashSetSync(list as IList<T>):` | Creates a synchronized hash set from a read-only list.
public | HashSetSync `HashSetSync(source as HashSet<T>):` | Creates a synchronized hash set from a regular hash set.
public | HashSetSync `HashSetSync(source as HashSetSync<T>):` | Creates a synchronized hash set from another synchronized hash set.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public native | _items `_items() as ArrayList<T>` | No summary.
public native | add `add(item as T) as Void` | Adds an element to the set.
public native | clear `clear() as Void` | Clears all elements.
public native | count `count(item as T) as ULong` | Counts occurrences of the given element in the set.
public | difference `difference(other as HashSetSync<T>) as HashSetSync<T>:` | Returns a new synchronized set containing elements from this set that are absent from `other`.
public | intersection `intersection(other as HashSetSync<T>) as HashSetSync<T>:` | Returns a new synchronized set containing elements present in both sets.
public | isSubsetOf `isSubsetOf(other as HashSetSync<T>) as Boolean:` | Returns true when every element of this set is present in `other`.
public | isSupersetOf `isSupersetOf(other as HashSetSync<T>) as Boolean:` | Returns true when this set contains every element of `other`.
public native | remove `remove(item as T) as Boolean` | Removes an element from the set.
public | symmetricDifference `symmetricDifference(other as HashSetSync<T>) as HashSetSync<T>:` | Returns a new synchronized set containing elements present in exactly one of the two sets.
public native | toString `toString() as String` | Returns a string representation of the set.
public | union `union(other as HashSetSync<T>) as HashSetSync<T>:` | Returns a new synchronized set containing all elements from this set and `other`.

Inherited Methods
method Inherited Methods from Object: deepCopy, fromJson, toDict, toJson, toXml
method Inherited Methods from Set: count
method Inherited Methods from Collection: add, remove, toString
Operators

Modifier and Type | Member | Description
--- | --- | ---
public native | operator in(item as T) as Boolean | Returns true if the set contains the element.

Inherited Operators
operator Inherited Operators from Set: operator in(item as T) as Boolean