Constructs an empty <tt>HashMap</tt> with the specified initial capacity and load factor.
Constructs an empty <tt>HashMap</tt> with the specified initial capacity and the default load factor (0.75).
Constructs an empty <tt>HashMap</tt> with the default initial capacity (16) and the default load factor (0.75).
Constructs a new <tt>HashMap</tt> with the same mappings as the specified <tt>Map</tt>. The <tt>HashMap</tt> is created with default load factor (0.75) and an initial capacity sufficient to hold the mappings in the specified <tt>Map</tt>.
Removes all of the mappings from this map. The map will be empty after this call returns.
Returns <tt>true</tt> if this map contains a mapping for the specified key.
Returns <tt>true</tt> if this map maps one or more keys to the specified value.
Returns the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key.
Implements Map.get and related methods
Returns a {@link Set} view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own <tt>remove</tt> operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> operations. It does not support the <tt>add</tt> or <tt>addAll</tt> operations.
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
Implements Map.putAll and Map constructor
Implements Map.put and related methods
Reset to initial default state. Called by clone and readObject.
Removes the mapping for the specified key from this map if present.
Implements Map.remove and related methods
Initializes or doubles table size. If null, allocates in accord with initial capacity target held in field threshold. Otherwise, because we are using power-of-two expansion, the elements from each bin must either stay at same index, or move with a power of two offset in the new table.
Replaces all linked nodes in bin at index for given hash unless table is too small, in which case resizes instead.
Computes key.toHash() and spreads (XORs) higher bits of hash to lower. Because the table uses power-of-two masking, sets of hashes that vary only in bits above the current mask will always collide. (Among known examples are sets of Float keys holding consecutive whole numbers in small tables.) So we apply a transform that spreads the impact of higher bits downward. There is a tradeoff between speed, utility, and quality of bit-spreading. Because many common sets of hashes are already reasonably distributed (so don't benefit from spreading), and because we use trees to handle large sets of collisions in bins, we just XOR some shifted bits in the cheapest possible way to reduce systematic lossage, as well as to incorporate impact of the highest bits that would otherwise never be used in index calculations because of table bounds.
Returns a power of two size for the given target capacity.
The default initial capacity - MUST be a power of two.
The load factor used when none specified in constructor.
The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments. MUST be a power of two <= 1<<30.
The smallest table capacity for which bins may be treeified. (Otherwise the table is resized if too many nodes in a bin.) Should be at least 4 * TREEIFY_THRESHOLD to avoid conflicts between resizing and treeification thresholds.
The bin count threshold for using a tree rather than list for a bin. Bins are converted to trees when adding an element to a bin with at least this many nodes. The value must be greater than 2 and should be at least 8 to mesh with assumptions in tree removal about conversion back to plain bins upon shrinkage.
The load factor for the hash table.
The number of times this HashMap has been structurally modified Structural modifications are those that change the number of mappings in the HashMap or otherwise modify its internal structure (e.g., rehash). This field is used to make iterators on Collection-views of the HashMap fail-fast. (See ConcurrentModificationException).
The table, initialized on first use, and resized as necessary. When allocated, length is always a power of two. (We also tolerate length zero in some operations to allow bootstrapping mechanics that are currently not needed.)
The next size value at which to resize (capacity * load factor).