public HashMap(int capacity) {if (capacity < 0) {throw new IllegalArgumentException("Capacity: " + capacity);}if (capacity == 0) {@SuppressWarnings("unchecked")HashMapEntry<K, V>[] tab = (HashMapEntry<K, V>[]) EMPTY_TABLE;table = tab;threshold = -1; return;}if (capacity < MINIMUM_CAPACITY) {capacity = MINIMUM_CAPACITY;} else if (capacity > MAXIMUM_CAPACITY) {capacity = MAXIMUM_CAPACITY;} else {capacity = roundUpToPowerOfTwo(capacity);}makeTable(capacity);}

public HashMap ( int capacity ) { if ( capacity < 0 ) { throw new IllegalArgumentException ( "Capacity: " + capacity ) ; } if ( capacity == 0 ) { @ SuppressWarnings ( "unchecked" ) HashMapEntry < K , V > [ ] tab = ( HashMapEntry < K , V > [ ] ) EMPTY_TABLE ; table = tab ; threshold = - 1 ; return ; } if ( capacity < MINIMUM_CAPACITY ) { capacity = MINIMUM_CAPACITY ; } else if ( capacity > MAXIMUM_CAPACITY ) { capacity = MAXIMUM_CAPACITY ; } else { capacity = roundUpToPowerOfTwo ( capacity ) ; } makeTable ( capacity ) ; }
public HashMap(int capacity){if (capacity < 0){throw new System.ArgumentException("Capacity: " + capacity);}if (capacity == 0){java.util.HashMap.HashMapEntry<K, V>[] tab = (java.util.HashMap.HashMapEntry<K, V>[])EMPTY_TABLE;table = tab;threshold = -1;return;}if (capacity < java.util.HashMap.MINIMUM_CAPACITY){capacity = java.util.HashMap.MINIMUM_CAPACITY;}else{if (capacity > java.util.HashMap.MAXIMUM_CAPACITY){capacity = java.util.HashMap.MAXIMUM_CAPACITY;}else{capacity = roundUpToPowerOfTwo(capacity);}}makeTable(capacity);}
