Example #1
0
        public void PutAll(IntHashMap m)
        {
            int numKeysToBeAdded = m._size;

            if (numKeysToBeAdded == 0)
            {
                return;
            }
            if (numKeysToBeAdded > _threshold)
            {
                int targetCapacity = (int)(numKeysToBeAdded / _loadFactor + 1);
                if (targetCapacity > 1 << 30)
                {
                    targetCapacity = 1 << 30;
                }
                int newCapacity = valueTables.Length;
                while (newCapacity < targetCapacity)
                {
                    newCapacity <<= 1;
                }
                if (newCapacity > valueTables.Length)
                {
                    Resize(newCapacity);
                }
            }
            for (int i = 0; i < _size; i++)
            {
                Entry e = valueTables[i];
                Put(e.GetKey(), e.GetValue());
            }
        }
Example #2
0
 internal void PutAllForCreate(IntHashMap m)
 {
     for (int i = 0; i < _size; i++)
     {
         Entry e = valueTables[i];
         PutForCreate(e.GetKey(), e.GetValue());
     }
 }
Example #3
0
        public virtual IntHashMap Clone()
        {
            IntHashMap result = null;

            try {
                result             = (IntHashMap)base.MemberwiseClone();
                result.valueTables = new Entry[valueTables.Length];
                result._modCount   = 0;
                result._size       = 0;
                result.Reset();
                result.PutAllForCreate(this);
            } catch (Exception) {
            }
            return(result);
        }
Example #4
0
		public void PutAll(IntHashMap m) {
			int numKeysToBeAdded = m._size;
			if (numKeysToBeAdded == 0) {
				return;
			}
			if (numKeysToBeAdded > _threshold) {
				int targetCapacity = (int) (numKeysToBeAdded / _loadFactor + 1);
				if (targetCapacity > 1 << 30) {
					targetCapacity = 1 << 30;
				}
				int newCapacity = valueTables.Length;
				while (newCapacity < targetCapacity) {
					newCapacity <<= 1;
				}
				if (newCapacity > valueTables.Length) {
					Resize(newCapacity);
				}
			}
			for (int i = 0; i < _size; i++) {
				Entry e = valueTables[i];
				Put(e.GetKey(), e.GetValue());
			}
		}
Example #5
0
		internal void PutAllForCreate(IntHashMap m) {
			for (int i = 0; i < _size; i++) {
				Entry e = valueTables[i];
				PutForCreate(e.GetKey(), e.GetValue());
			}
		}