/// <summary> /// Removes all the elements. /// </summary> /// <returns>Returns the removed pairs.</returns> public IEnumerable <T> ClearEnumerable() { return(Interlocked.Exchange(ref _bucket, _bucket = new Bucket <T>())); }
/// <summary> /// Initializes a new instance of the <see cref="SafeSet{T}" /> class. /// </summary> /// <param name="comparer">The value comparer.</param> /// <param name="initialProbing">The number of steps in linear probing.</param> public SafeSet(IEqualityComparer <T> comparer, int initialProbing) { _comparer = comparer ?? EqualityComparer <T> .Default; _bucket = new Bucket <T>(); _probing = initialProbing; }
/// <summary> /// Removes all the elements. /// </summary> public void Clear() { _bucket = new Bucket <T>(); }