public synchronized boolean contains(Object obj) { if (obj == null) { return false; } Entry<T>[] tab = this.table; int hash = hashCode(obj); int index = (hash & 0x7fffffff) % tab.length; for (Entry<T> e = tab[index], prev = null; e != null; e = e.next) { Object iobj = e.get(); if (iobj == null) { // Clean up after a cleared Reference. if (prev != null) { prev.next = e.next; } else { tab[index] = e.next; } this.count--; } else if (e.hash == hash && obj.getClass() == iobj.getClass() && equals(obj, iobj)) { // Found canonical instance. return true; } else { prev = e; } } return false; }
int hash = hashCode(obj); int index = (hash & 0x7fffffff) % tab.length;
public synchronized boolean contains(Object obj) { if (obj == null) { return false; } Entry<T>[] entries = mEntries; int hash = hashCode(obj); int index = (hash & 0x7fffffff) % entries.length; for (Entry<T> e = entries[index]; e != null; e = e.mNext) { Object iobj = e.get(); if (iobj != null && e.mHash == hash && obj.getClass() == iobj.getClass() && equals(obj, iobj)) { // Found canonical instance. return true; } } return false; }
int hash = hashCode(obj); int index = (hash & 0x7fffffff) % entries.length; for (Entry<T> e = entries[index], prev = null; e != null; e = e.mNext) {