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()); } }
internal void PutAllForCreate(IntHashMap m) { for (int i = 0; i < _size; i++) { Entry e = valueTables[i]; PutForCreate(e.GetKey(), e.GetValue()); } }
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); }
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()); } }