/** * Add a new entry with the specified key, value and hash code to the specified bucket. It is * the responsibility of this method to resize the table if appropriate. * * Subclass overrides this to alter the behavior of put method. * * @param key * @param value * @param bucketIndex */ void addEntry(int key, V value, int bucketIndex) { table[bucketIndex] = new Entry<V>(key, value, table[bucketIndex]); if (size++ >= threshold) { resize(2 * table.length); } }
/** * Add a new entry with the specified key, value and hash code to the specified bucket. It is * the responsibility of this method to resize the table if appropriate. * * Subclass overrides this to alter the behavior of put method. * * @param key * @param value * @param bucketIndex */ void addEntry(final int key, final V value, final int bucketIndex) { table[bucketIndex] = new Entry<>(key, value, table[bucketIndex]); if (size++ >= threshold) { resize(2 * table.length); } }
/** * Like addEntry except that this version is used when creating entries as part of Map * construction or "pseudo-construction" (cloning, deserialization). This version needn't worry * about resizing the table. * * Subclass overrides this to alter the behavior of HashMap(Map), clone, and readObject. * * @param key * @param value * @param bucketIndex */ void createEntry(int key, V value, int bucketIndex) { table[bucketIndex] = new Entry<V>(key, value, table[bucketIndex]); size++; }
/** * Like addEntry except that this version is used when creating entries as part of Map * construction or "pseudo-construction" (cloning, deserialization). This version needn't worry * about resizing the table. * * Subclass overrides this to alter the behavior of HashMap(Map), clone, and readObject. * * @param key * @param value * @param bucketIndex */ void createEntry(final int key, final V value, final int bucketIndex) { table[bucketIndex] = new Entry<>(key, value, table[bucketIndex]); size++; }
/** * Add a new entry with the specified key, value and hash code to the specified bucket. It is * the responsibility of this method to resize the table if appropriate. * * Subclass overrides this to alter the behavior of put method. * * @param key * @param value * @param bucketIndex */ void addEntry(int key, Object value, int bucketIndex) { table[bucketIndex] = new Entry(key, value, table[bucketIndex]); if (size++ >= threshold) { resize(2 * table.length); } }
/** * Like addEntry except that this version is used when creating entries as part of Map * construction or "pseudo-construction" (cloning, deserialization). This version needn't worry * about resizing the table. * * Subclass overrides this to alter the behavior of HashMap(Map), clone, and readObject. * * @param key * @param value * @param bucketIndex */ void createEntry(int key, Object value, int bucketIndex) { table[bucketIndex] = new Entry(key, value, table[bucketIndex]); size++; }