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