private void grow() { final V[] oldTable = table; final int oldSize = table.length; initTable(oldSize << 1); for (int i = 0; i < oldSize; i++) { final V obj = oldTable[i]; if (obj != null) insert(obj); } }
/** * Store an object for future lookup. * <p> * An existing mapping for <b>must not</b> be in this map. Callers must * first call {@link #get(AnyObjectId)} to verify there is no current * mapping prior to adding a new mapping, or use * {@link #addIfAbsent(ObjectId)}. * * @param newValue * the object to store. */ public <Q extends V> void add(Q newValue) { if (++size == grow) grow(); insert(newValue); }
insert(newValue); } else { tbl[i] = newValue;
private void grow() { final V[] oldTable = table; final int oldSize = table.length; initTable(oldSize << 1); for (int i = 0; i < oldSize; i++) { final V obj = oldTable[i]; if (obj != null) insert(obj); } }
private void grow() { final V[] oldTable = table; final int oldSize = table.length; initTable(oldSize << 1); for (int i = 0; i < oldSize; i++) { final V obj = oldTable[i]; if (obj != null) insert(obj); } }
/** * Store an object for future lookup. * <p> * An existing mapping for <b>must not</b> be in this map. Callers must * first call {@link #get(AnyObjectId)} to verify there is no current * mapping prior to adding a new mapping, or use * {@link #addIfAbsent(ObjectId)}. * * @param newValue * the object to store. */ public <Q extends V> void add(Q newValue) { if (++size == grow) grow(); insert(newValue); }
/** * Store an object for future lookup. * <p> * An existing mapping for <b>must not</b> be in this map. Callers must * first call {@link #get(AnyObjectId)} to verify there is no current * mapping prior to adding a new mapping, or use * {@link #addIfAbsent(ObjectId)}. * * @param newValue * the object to store. * @param <Q> * type of instance to store. */ public <Q extends V> void add(final Q newValue) { if (++size == grow) grow(); insert(newValue); }
insert(newValue); } else { tbl[i] = newValue;
insert(newValue); } else { tbl[i] = newValue;