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.

@param <T> Element type. @since 1.0

Properties

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

Properties inherited 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 native | remove `remove(item as T) as Boolean` | Removes an element from the set.
public native | toString `toString() as String` | Returns a string representation of the set.

Methods inherited from Object: fromJson, toDict, toJson, toXml
Methods inherited from Set: count
Methods inherited 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.

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