Example #1
0
            /// <summary>
            /// Creates a new hashMap iterator for the given hash map.
            /// </summary>
            /// <param name="hashMap"></param>
            public ConcurrentHashMapDictionaryEnumerator(ConcurrentHashMap <K, V> hashMap)
            {
                items = new List <DictionaryEntry>();

                for (int i = 0; i < hashMap.buckets.Length; i++)
                {
                    Node currentNode = hashMap.buckets[i];

                    while (currentNode != null)
                    {
                        items.Add(new DictionaryEntry(currentNode.kvp.Key, currentNode.kvp.Value));
                        currentNode = currentNode.next;
                    }
                }
            }
Example #2
0
 /// <summary>
 /// Creates a new concurrent hashset.
 /// </summary>
 /// <param name="comparer"></param>
 /// <param name="numberOfBuckets"></param>
 /// <param name="numberOfStripes"></param>
 public ConcurrentHashSet(IEqualityComparer <T> comparer = null, uint numberOfBuckets = 128, uint numberOfStripes = 16)
 {
     this.dictionary = new ConcurrentHashMap <T, bool>(comparer, numberOfBuckets, numberOfStripes);
 }