Esempio n. 1
0
            public HashTable(int capacity)
            {
                if (capacity < 1)
                {
                    throw new ArgumentException("number less < 1");
                }

                _array    = new _003_HashTableArray.HashTableArray <TKey, TValue>(capacity);
                _maxItems = (int)(_fillFactor * capacity) + 1;
            }
Esempio n. 2
0
            public void Add(TKey key, TValue value)
            {
                if (_count >= _maxItems)
                {
                    var tmp = new _003_HashTableArray.HashTableArray <TKey, TValue>(_array.Count * 2);

                    foreach (var item in _array)
                    {
                        tmp.Add(item.Key, item.Value);
                    }

                    _array    = tmp;
                    _maxItems = (int)(_fillFactor * _array.Count) + 1;
                }
                _array.Add(key, value);
                _count++;
            }