public static <K, V> HashMap<K, V> newHashMapWithExpectedSize(int expectedSize) {
    return new HashMap<>(capacity(expectedSize));
  }
public static <K, V> HashMap<K, V> newHashMapWithExpectedSize(int expectedSize) {
    return new HashMap<>(capacity(expectedSize));
  }
public static < K , V > HashMap < K , V > newHashMapWithExpectedSize ( int expectedSize ) { return new HashMap <> ( capacity ( expectedSize ) ) ; }
Creates a {@code HashMap} instance, with a high enough "initial capacity" that it <i>should</i>
hold {@code expectedSize} elements without growth. This behavior cannot be broadly guaranteed,
but it is observed to be true for OpenJDK 1.7. It also can't be guaranteed that the method
isn't inadvertently <i>oversizing</i> the returned map.

@param expectedSize the number of entries you expect to add to the returned map
@return a new, empty {@code HashMap} with enough capacity to hold {@code expectedSize} entries
without resizing
@throws IllegalArgumentException if {@code expectedSize} is negative
Creates a { @code HashMap } instance with a high enough initial capacity that it <i > should< / i > hold { @code expectedSize } elements without growth . This behavior cannot be broadly guaranteed but it is observed to be true for OpenJDK 1 . 7 . It also can t be guaranteed that the method isn t inadvertently <i > oversizing< / i > the returned map .