Mutable Scatter Set
MutableScatterSet is a container with a MutableSet-like interface based on a flat hash table implementation. The underlying implementation is designed to avoid all allocations on insertion, removal, retrieval, and iteration. Allocations may still happen on insertion when the underlying storage needs to grow to accommodate newly added elements to the set.
This implementation makes no guarantee as to the order of the elements stored, nor does it make guarantees that the order remains constant over time.
This implementation is not thread-safe: if multiple threads access this container concurrently, and one or more threads modify the structure of the set (insertion or removal for instance), the calling code must provide the appropriate synchronization. Concurrent reads are however safe.
Note: when a Set is absolutely necessary, you can use the method asSet to create a thin wrapper around a MutableScatterSet. Please refer to asSet for more details and caveats.
Note: when a MutableSet is absolutely necessary, you can use the method asMutableSet to create a thin wrapper around a MutableScatterSet. Please refer to asMutableSet for more details and caveats.
Parameters
The initial desired capacity for this container. the container will honor this value by guaranteeing its internal structures can hold that many elements without requiring any allocations. The initial capacity can be set to 0.
See also
Constructors
Creates a new MutableScatterSet
Properties
Functions
Wraps this ScatterSet with a MutableSet interface. The MutableSet is backed by the ScatterSet, so changes to the ScatterSet are reflected in the MutableSet and vice-versa. If the ScatterSet is modified while an iteration over the MutableSet is in progress (and vice- versa), the results of the iteration are undefined.
Wraps this ScatterSet with a Set interface. The Set is backed by the ScatterSet, so changes to the ScatterSet are reflected in the Set. If the ScatterSet is modified while an iteration over the Set is in progress, the results of the iteration are undefined.
Returns true if this set is not empty.
Trims this MutableScatterSet's storage so it is sized appropriately to hold the current elements.