Java HashMap Create newHashMapWithCapacity(int expectedSize, float loadFactor)

Here you can find the source of newHashMapWithCapacity(int expectedSize, float loadFactor)

Description

new Hash Map With Capacity

License

Apache License

Declaration

public static <K, V> HashMap<K, V> newHashMapWithCapacity(int expectedSize, float loadFactor) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.HashMap;

public class Main {

    public static <K, V> HashMap<K, V> newHashMapWithCapacity(int expectedSize, float loadFactor) {
        int finalSize = (int) ((double) expectedSize / loadFactor + 1.0F);
        return new HashMap<K, V>(finalSize, loadFactor);
    }//w ww.j a v a2 s .  co m
}

Related

  1. newHashMap(K[] keys, V[] values)
  2. newHashMap(Map.Entry... entries)
  3. newHashMap(Map m)
  4. newHashMap(Object... kv)
  5. newHashMap(T key, U value)
  6. toHashMap( Entry[] entries)
  7. toHashMap(ArrayList list, int beginId)
  8. toHashMap(final Map map)
  9. toHashMapStrObj(Object object)