@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int size = in.readInt(); this.loadFactor = in.readFloat(); this.init(Math.max((int) (size / this.loadFactor) + 1, DEFAULT_INITIAL_CAPACITY)); for (int i = 0; i < size; i++) { this.add((T) in.readObject()); } }
public UnifiedSet(int initialCapacity, float loadFactor) { if (initialCapacity < 0) { throw new IllegalArgumentException("initial capacity cannot be less than 0"); } if (loadFactor <= 0.0) { throw new IllegalArgumentException("load factor cannot be less than or equal to 0"); } if (loadFactor > 1.0) { throw new IllegalArgumentException("load factor cannot be greater than 1"); } this.loadFactor = loadFactor; this.init(this.fastCeil(initialCapacity / loadFactor)); }
public UnifiedSet(int initialCapacity, float loadFactor) { if (initialCapacity < 0) { throw new IllegalArgumentException("initial capacity cannot be less than 0"); } if (loadFactor <= 0.0) { throw new IllegalArgumentException("load factor cannot be less than or equal to 0"); } if (loadFactor > 1.0) { throw new IllegalArgumentException("load factor cannot be greater than 1"); } this.loadFactor = loadFactor; this.init(this.fastCeil(initialCapacity / loadFactor)); }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int size = in.readInt(); this.loadFactor = in.readFloat(); this.init(Math.max((int) (size / this.loadFactor) + 1, DEFAULT_INITIAL_CAPACITY)); for (int i = 0; i < size; i++) { this.add((T) in.readObject()); } }
public boolean trimToSize() { if (this.table.length <= (this.fastCeil(this.occupied / this.loadFactor) << 1)) { return false; } Object[] temp = this.table; this.init(this.fastCeil(this.occupied / this.loadFactor)); if (this.isEmpty()) { return true; } int mask = this.table.length - 1; for (int j = 0; j < temp.length; j++) { Object cur = temp[j]; if (cur instanceof ChainedBucket) { ChainedBucket bucket = (ChainedBucket) cur; this.chainedTrimToSize(bucket, j, mask); } else if (cur != null) { this.addForTrim(cur, j, mask); } } return true; }
public boolean trimToSize() { if (this.table.length <= (this.fastCeil(this.occupied / this.loadFactor) << 1)) { return false; } Object[] temp = this.table; this.init(this.fastCeil(this.occupied / this.loadFactor)); if (this.isEmpty()) { return true; } int mask = this.table.length - 1; for (int j = 0; j < temp.length; j++) { Object cur = temp[j]; if (cur instanceof ChainedBucket) { ChainedBucket bucket = (ChainedBucket) cur; this.chainedTrimToSize(bucket, j, mask); } else if (cur != null) { this.addForTrim(cur, j, mask); } } return true; }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int size = in.readInt(); this.loadFactor = in.readFloat(); this.init(Math.max((int) (size / this.loadFactor) + 1, DEFAULT_INITIAL_CAPACITY)); for (int i = 0; i < size; i++) { this.add((T) in.readObject()); } }
public UnifiedSet(int initialCapacity, float loadFactor) { if (initialCapacity < 0) { throw new IllegalArgumentException("initial capacity cannot be less than 0"); } if (loadFactor <= 0.0) { throw new IllegalArgumentException("load factor cannot be less than or equal to 0"); } if (loadFactor > 1.0) { throw new IllegalArgumentException("load factor cannot be greater than 1"); } this.loadFactor = loadFactor; this.init(this.fastCeil(initialCapacity / loadFactor)); }
public boolean trimToSize() { if (this.table.length <= (this.fastCeil(this.occupied / this.loadFactor) << 1)) { return false; } Object[] temp = this.table; this.init(this.fastCeil(this.occupied / this.loadFactor)); if (this.isEmpty()) { return true; } int mask = this.table.length - 1; for (int j = 0; j < temp.length; j++) { Object cur = temp[j]; if (cur instanceof ChainedBucket) { ChainedBucket bucket = (ChainedBucket) cur; this.chainedTrimToSize(bucket, j, mask); } else if (cur != null) { this.addForTrim(cur, j, mask); } } return true; }