/** * Create a new hash map with initial capacity and load factor control. * (constructor shortcut). */ public static ByteCharHashMap newInstance(final int initialCapacity, final double loadFactor) { return new ByteCharHashMap(initialCapacity, loadFactor); }
/** * Create a hash map from another associative container. (constructor shortcut) Default load factor is used. */ public static ByteCharHashMap from( final ByteCharAssociativeContainer container) { return new ByteCharHashMap(container); }
/** * Create a new hash map without providing the full generic signature * (constructor shortcut). */ public static ByteCharHashMap newInstance() { return new ByteCharHashMap(); }
/** * Creates a hash map from two index-aligned arrays of key-value pairs. Default load factor is used. */ public static ByteCharHashMap from(final byte[] keys, final char[] values) { if (keys.length != values.length) { throw new IllegalArgumentException("Arrays of keys and values must have an identical length."); } final ByteCharHashMap map = new ByteCharHashMap(keys.length); for (int i = 0; i < keys.length; i++) { map.put(keys[i], values[i]); } return map; }
/** * {@inheritDoc} */ @Override public ByteCharHashMap clone() { //clone to size() to prevent some cases of exponential sizes, final ByteCharHashMap cloned = new ByteCharHashMap(this.size(), this.loadFactor); //We must NOT clone because of independent perturbations seeds cloned.putAll(this); return cloned; }