/** * Same as {@link #chooseBetter(HashConfigWrapper, int, int, int, int, int)}. * * @see #chooseBetter(HashConfigWrapper, int, int, int, int, int) */ static long chooseBetter(HashConfigWrapper conf, long size, long desiredCapacity, long lesserCapacity, long greaterCapacity, long onFail) { assert 0L <= size; assert size < lesserCapacity && lesserCapacity < desiredCapacity; assert desiredCapacity < greaterCapacity; if (greaterCapacity - desiredCapacity <= desiredCapacity - lesserCapacity && greaterCapacity <= conf.maxCapacity(size)) { return greaterCapacity; } return lesserCapacity >= conf.minCapacity(size) ? lesserCapacity : onFail; }
/** * Same as {@link #chooseBetter(HashConfigWrapper, int, int, int, int, int)}. * * @see #chooseBetter(HashConfigWrapper, int, int, int, int, int) */ static long chooseBetter(HashConfigWrapper conf, long size, long desiredCapacity, long lesserCapacity, long greaterCapacity, long onFail) { assert 0L <= size; assert size < lesserCapacity && lesserCapacity < desiredCapacity; assert desiredCapacity < greaterCapacity; if (greaterCapacity - desiredCapacity <= desiredCapacity - lesserCapacity && greaterCapacity <= conf.maxCapacity(size)) { return greaterCapacity; } return lesserCapacity >= conf.minCapacity(size) ? lesserCapacity : onFail; }
return greaterCapacity; return lesserCapacity >= conf.minCapacity(size) ? lesserCapacity : onFail;
return greaterCapacity; return lesserCapacity >= conf.minCapacity(size) ? lesserCapacity : onFail;