Here you can find the source of hashCapacityForSize(final int size)
Parameter | Description |
---|---|
size | size to calculate the minimal capacity |
public static int hashCapacityForSize(final int size)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w.j a va 2 s.c om*/ * Returns the minimal capacity of hash-based structures (e.g. {@link HashSet} or {@link HashMap}) calculated from the specified size (number of elements) * and the default load factor (which is 0.75). * * @param size size to calculate the minimal capacity * @return the minimal capacity of hash-based structures for the specified size */ public static int hashCapacityForSize(final int size) { return size * 4 / 3 + 1; } }