private void initSlotCounts(int capacity) { maxSize = maxSize(capacity); minFreeSlots = minFreeSlots(capacity, size, hashConfig().getMaxLoad(), maxSize); int freeSlots = this.freeSlots = capacity - size; // free could be less than minFreeSlots only in case when capacity // is not sufficient to comply load factor (due to saturation with // Java array size limit). Set minFreeSlots to a half of free to avoid // too often (instant) rehashing in this case. if (freeSlots < minFreeSlots) this.minFreeSlots = (freeSlots + 1) / 2; removedSlots = 0; }
private void initSlotCounts(int capacity) { maxSize = maxSize(capacity); minFreeSlots = minFreeSlots(capacity, size, hashConfig().getMaxLoad(), maxSize); int freeSlots = this.freeSlots = capacity - size; // free could be less than minFreeSlots only in case when capacity // is not sufficient to comply load factor (due to saturation with // Java array size limit). Set minFreeSlots to a half of free to avoid // too often (instant) rehashing in this case. if (freeSlots < minFreeSlots) this.minFreeSlots = (freeSlots + 1) / 2; removedSlots = 0; }
/** * Root operation for copy constructors * * @param hash Mutable or Immutable QHash instance */ final void copy(QHash hash) { this.configWrapper = hash.configWrapper(); int size = this.size = hash.size(); int capacity = hash.capacity(); this.maxSize = maxSize(capacity); int freeSlots = this.freeSlots = hash.freeSlots(); int minFreeSlots = this.minFreeSlots = minFreeSlots(capacity, size, hashConfig().getMaxLoad(), maxSize); // see #initSlotCounts() if (freeSlots < minFreeSlots) this.minFreeSlots = (freeSlots + 1) / 2; this.removedSlots = hash.removedSlots(); }
/** * Root operation for copy constructors * * @param hash Mutable or Immutable QHash instance */ final void copy(QHash hash) { this.configWrapper = hash.configWrapper(); int size = this.size = hash.size(); int capacity = hash.capacity(); this.maxSize = maxSize(capacity); int freeSlots = this.freeSlots = hash.freeSlots(); int minFreeSlots = this.minFreeSlots = minFreeSlots(capacity, size, hashConfig().getMaxLoad(), maxSize); // see #initSlotCounts() if (freeSlots < minFreeSlots) this.minFreeSlots = (freeSlots + 1) / 2; this.removedSlots = hash.removedSlots(); }