public boolean containsValue(Object value) { if (isEmpty()) { return false; } if (value == null) { return containsNullValue(); } for (int i = 0; i < myTable.length; i++) { TableEntry entry = myTable[i]; while (entry != null) { if (value.equals(entry.value)) { return true; } entry = entry.next; } } return false; }
public boolean containsValue(Object value) { if (isEmpty()) { return false; } if (value == null) { return containsNullValue(); } for (int i = 0; i < myTable.length; i++) { TableEntry entry = myTable[i]; while (entry != null) { if (value.equals(entry.value)) { return true; } entry = entry.next; } } return false; }
public boolean containsValue(Object value) { if (isEmpty()) { return false; } if (value == null) { return containsNullValue(); } for (int i = 0; i < myTable.length; i++) { TableEntry entry = myTable[i]; while (entry != null) { if (value.equals(entry.getValue())) { return true; } entry = entry.next; } } return false; }
public Object remove(Object key) { if (isEmpty()) { return null; } key = key == null ? NULL_KEY : key; int hash = hashCode(key); int index = indexForHash(hash); TableEntry entry = myTable[index]; TableEntry previousEntry = null; while (entry != null) { if (entry.hash == hash && entry.key.equals(key)) { if (previousEntry != null) { previousEntry.next = entry.next; } else { myTable[index] = entry.next; } myEntryCount--; myModCount++; return entry.getValue(); } previousEntry = entry; entry = entry.next; } return null; }
public Object remove(Object key) { if (isEmpty()) { return null; } key = key == null ? NULL_KEY : key; int hash = hashCode(key); int index = indexForHash(hash); TableEntry entry = myTable[index]; TableEntry previousEntry = null; while (entry != null) { if (entry.hash == hash && entry.key.equals(key)) { if (previousEntry != null) { previousEntry.next = entry.next; } else { myTable[index] = entry.next; } myEntryCount--; myModCount++; return entry.getValue(); } previousEntry = entry; entry = entry.next; } return null; }
public boolean containsKey(Object key) { if (isEmpty()) { return false; } key = key == null ? NULL_KEY : key; int hash = hashCode(key); int index = indexForHash(hash); TableEntry entry = myTable[index]; while (entry != null) { if (entry.hash == hash && eq(key, entry.key)) { return true; } entry = entry.next; } return false; }
public Object remove(Object key) { if (isEmpty()) { return null; } key = key == null ? NULL_KEY : key; int hash = hashCode(key); int index = indexForHash(hash); TableEntry entry = myTable[index]; TableEntry previousEntry = null; while (entry != null) { if (entry.hash == hash && entry.key.equals(key)) { if (previousEntry != null) { previousEntry.next = entry.next; } else { myTable[index] = entry.next; } myEntryCount--; myModCount++; return entry.getValue(); } previousEntry = entry; entry = entry.next; } return null; }
public boolean containsKey(Object key) { if (isEmpty()) { return false; } key = key == null ? NULL_KEY : key; int hash = hashCode(key); int index = indexForHash(hash); TableEntry entry = myTable[index]; while (entry != null) { if (entry.hash == hash && eq(key, entry.key)) { return true; } entry = entry.next; } return false; }
public boolean containsKey(Object key) { if (isEmpty()) { return false; } key = key == null ? NULL_KEY : key; int hash = hashCode(key); int index = indexForHash(hash); TableEntry entry = myTable[index]; while (entry != null) { if (entry.hash == hash && eq(key, entry.key)) { return true; } entry = entry.next; } return false; }