Java Hash Calculate hashMapCapacity(final int nElements)

Here you can find the source of hashMapCapacity(final int nElements)

Description

return a good initialCapacity for a HashMap that will hold a given number of elements

License

Open Source License

Declaration

public static int hashMapCapacity(final int nElements) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /** return a good initialCapacity for a HashMap that will hold a given number of elements */
    public static int hashMapCapacity(final int nElements) {
        return (int) ((nElements * 4L) / 3) + 1;
    }/*w w  w  . j a  v a  2 s. c o m*/
}

Related

  1. hashJava32(byte[] byteList)
  2. hashJava64(byte[] byteList)
  3. hashJenkins(int init, Object... vals)
  4. hashLong(long id)
  5. hashLong(long l)
  6. hashMore(final int hash, final int more)
  7. hashName(CharSequence name)
  8. hashObject(Object obj)
  9. hashOrNull(Object value)