mirror of
https://github.com/maxkratz/fastutil.git
synced 2024-09-16 11:58:09 +00:00
Hash-based big sets now expose ensureCapacity()
This commit is contained in:
parent
85bb33b1bf
commit
540fed8147
1 changed files with 6 additions and 1 deletions
|
@ -341,7 +341,12 @@ public class OPEN_HASH_BIG_SET KEY_GENERIC extends ABSTRACT_SET KEY_GENERIC impl
|
|||
return containsNull ? size - 1 : size;
|
||||
}
|
||||
|
||||
private void ensureCapacity(final long capacity) {
|
||||
/** Ensures that this big set can hold a certain number of elements without rehashing.
|
||||
*
|
||||
* @param capacity a number of elements; there will be no rehashing unless
|
||||
* the set {@linkplain #size64() size} exceeds this number.
|
||||
*/
|
||||
public void ensureCapacity(final long capacity) {
|
||||
final long needed = bigArraySize(capacity, f);
|
||||
if (needed > n) rehash(needed);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue