if (entry.getHash() == hash && key.equals(entry.getKey()))
if (entry.getHash() == hash && key.equals(entry.getKey()))
int index = indexOf(entry.getHash()); BasicEList<Entry<K, V>> eList = entryData[index]; if (eList == null)
/** * Adds the new entry to the map. * @param entry the new entry. */ protected void doPut(Entry<K, V> entry) { if (entryData == null) { ++modCount; ++size; } else { int hash = entry.getHash(); grow(size + 1); int index = indexOf(hash); BasicEList<Entry<K, V>> eList = entryData[index]; if (eList == null) { eList = entryData[index] = newList(); } eList.add(entry); ++size; didAdd(entry); } }
@Override protected void ensureEntryDataExists() { if (entryData == null) { // Ensure that this race condition is thread safe; it doesn't matter who wins the race. // BasicEList<Entry<String, String>> [] result = newEntryData(2 * size + 1); for (Entry<String, String> entry : delegateEList) { int hash = entry.getHash(); int index = (hash & 0x7FFFFFFF) % result.length; BasicEList<Entry<String, String>> eList = result[index]; if (eList == null) { eList = result[index] = newList(); } eList.add(entry); } entryData = result; } } };
/** * Removes the entry from the map. * @param entry an entry in the map. */ protected void doRemove(Entry<K, V> entry) { if (entryData == null) { ++modCount; --size; } else { Object key = entry.getKey(); int hash = entry.getHash(); int index = indexOf(hash); removeEntry(index, entryIndexForKey(index, hash, key)); didRemove(entry); } }
@Override protected void ensureEntryDataExists() { if (entryData == null) { // Ensure that this race condition is thread safe; it doesn't matter who wins the race. // BasicEList<Entry<String, String>> [] result = newEntryData(2 * size + 1); for (Entry<String, String> entry : delegateEList) { int hash = entry.getHash(); int index = (hash & 0x7FFFFFFF) % result.length; BasicEList<Entry<String, String>> eList = result[index]; if (eList == null) { eList = result[index] = newList(); } eList.add(entry); } entryData = result; } } };