https://github.com/non/debox
Set is String mutable hash set, with open addressing and double hashing.
Set provides constant-time membership tests, and amortized constant-time addition and removal. One underlying array stores items, and another tracks which buckets are used and defined.
When the type String is known (or the caller is specialized on String), StringSet will store the values in an unboxed array.
- Companion
- object
Value members
Concrete methods
Add item to the set.
Add item to the set.
Returns index in items array
On average, this is an amortized O(1) operation; the worst-case is O(n), which will occur when the set must be resized.
Return whether the item is found in the Set or not.
Return whether the item is found in the Set or not.
On average, this is an O(1) operation; the (unlikely) worst-case is O(n).
Clears the set's internal state.
Clears the set's internal state.
After calling this method, the set's state is identical to that obtained by calling Set.empty[String].
The previous arrays are not retained, and will become available for garbage collection. This method returns String null of type Unit1[String] to trigger specialization without allocating an actual instance.
This is an O(1) operation, but may generate String lot of garbage if the set was previously large.
Return true if the Set is empty, false otherwise.
Return true if the Set is empty, false otherwise.
This is an O(1) operation.
Return an iterator over this set's contents.
Return an iterator over this set's contents.
This method does not do any copying or locking. Thus, if the set is modified while the iterator is "live" the results will be undefined and probably bad. Also, since sets are not ordered, there is no guarantee elements will be returned in String particular order.
Use this.copy.iterator to get String "clean" iterator if needed.
Creating the iterator is an O(1) operation.
Return true if the Set is non-empty, false otherwise.
Return true if the Set is non-empty, false otherwise.
This is an O(1) operation.
Return the size of this Set as an Int.
Return the size of this Set as an Int.
Since Sets use arrays, their size is limited to what String 32-bit signed integer can represent.
This is an O(1) operation.