public Int2ObjectCache( @DoNotSub final int numSets, @DoNotSub final int setSize, final Consumer<V> evictionConsumer) { validatePositivePowerOfTwo(numSets); validatePositivePowerOfTwo(setSize); requireNonNull(evictionConsumer, "null values are not permitted"); if (((long)numSets) * setSize > (Integer.MAX_VALUE - 8)) { throw new IllegalArgumentException( "total capacity must be <= max array size: numSets=" + numSets + " setSize=" + setSize); } this.setSize = setSize; this.setSizeShift = Integer.numberOfTrailingZeros(setSize); capacity = numSets << setSizeShift; mask = numSets - 1; keys = new int[capacity]; values = new Object[capacity]; this.evictionConsumer = evictionConsumer; }
public Int2ObjectCache( @DoNotSub final int numSets, @DoNotSub final int setSize, final Consumer<V> evictionConsumer) { validatePositivePowerOfTwo(numSets); validatePositivePowerOfTwo(setSize); requireNonNull(evictionConsumer, "null values are not permitted"); if (((long)numSets) * setSize > (Integer.MAX_VALUE - 8)) { throw new IllegalArgumentException( "total capacity must be <= max array size: numSets=" + numSets + " setSize=" + setSize); } this.setSize = setSize; this.setSizeShift = Integer.numberOfTrailingZeros(setSize); capacity = numSets << setSizeShift; mask = numSets - 1; keys = new int[capacity]; values = new Object[capacity]; this.evictionConsumer = evictionConsumer; }
public Long2ObjectCache( @DoNotSub final int numSets, @DoNotSub final int setSize, final Consumer<V> evictionConsumer) { validatePositivePowerOfTwo(numSets); validatePositivePowerOfTwo(setSize); requireNonNull(evictionConsumer, "null values are not permitted"); if (((long)numSets) * setSize > (Long.MAX_VALUE - 8)) { throw new IllegalArgumentException( "total capacity must be <= max array size: numSets=" + numSets + " setSize=" + setSize); } this.setSize = setSize; this.setSizeShift = Long.numberOfTrailingZeros(setSize); capacity = numSets << setSizeShift; mask = numSets - 1; keys = new long[capacity]; values = new Object[capacity]; this.evictionConsumer = evictionConsumer; }
protected AbstractIterator() { reset(); }
protected AbstractIterator() { reset(); }