HashSetSync
classin packageklyn.collections
public class HashSetSync<T> extends Object implements Set<T>:
└ 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.

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 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.
Methods inherited from Object: deepCopy, 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