public String toString() { return new StringBuffer().append(getKey()).append('=').append(getValue()).toString(); } }
public String toString() { return new StringBuffer().append(getKey()).append('=').append(getValue()).toString(); } }
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof Map.Entry == false) { return false; } Map.Entry other = (Map.Entry) obj; return (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) && (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue())); }
/** * Gets the value mapped to the key specified. * * @param key the key * @return the mapped value, null if no match */ public Object get(Object key) { key = convertKey(key); int hashCode = hash(key); HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) { return entry.getValue(); } entry = entry.next; } return null; }
/** * Gets the value mapped to the specified multi-key. * * @param key1 the first key * @param key2 the second key * @return the mapped value, null if no match */ public Object get(Object key1, Object key2) { int hashCode = hash(key1, key2); AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) { return entry.getValue(); } entry = entry.next; } return null; }
public class Prober<PT> { public Prober(TypeComparator<PT> probeComparator, TypePairComparator<PT, BT> pairComparator) { this.probeComparator = probeComparator; this.pairComparator = pairComparator; } private final TypeComparator<PT> probeComparator; private final TypePairComparator<PT, BT> pairComparator; @SuppressWarnings("unchecked") public BT lookupMatch(PT record) { int hashCode = hash(probeComparator.hash(record)); int index = hashIndex(hashCode, data.length); pairComparator.setReference(record); HashEntry entry = data[index]; while (entry != null) { if (entryHashCode(entry) == hashCode && pairComparator.equalToReference((BT) entry.getValue())) { return (BT) entry.getValue(); } entry = entryNext(entry); } return null; } } }
public Object next() { return super.nextEntry().getValue(); } }
public Object getValue() { HashEntry current = currentEntry(); if (current == null) { throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID); } return current.getValue(); }
public Object getValue() { HashEntry current = currentEntry(); if (current == null) { throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID); } return current.getValue(); }
public Object getValue() { HashEntry current = currentEntry(); if (current == null) { throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID); } return current.getValue(); }
public String toString() { if (last != null) { return "Iterator[" + last.getKey() + "=" + last.getValue() + "]"; } else { return "Iterator[]"; } } }
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof Map.Entry == false) { return false; } Map.Entry other = (Map.Entry) obj; return (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) && (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue())); }
public Object next() { return super.nextEntry().getValue(); } }
@SuppressWarnings("unchecked") public void insertOrReplace(BT record) { int hashCode = hash(buildComparator.hash(record)); int index = hashIndex(hashCode, data.length); buildComparator.setReference(record); HashEntry entry = data[index]; while (entry != null) { if (entryHashCode(entry) == hashCode && buildComparator.equalToReference((BT) entry.getValue())) { entry.setValue(record); return; } entry = entryNext(entry); } addMapping(index, hashCode, null, record); }
public String toString() { if (last != null) { return "Iterator[" + last.getKey() + "=" + last.getValue() + "]"; } else { return "Iterator[]"; } } }
public Object getValue() { HashEntry current = currentEntry(); if (current == null) { throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID); } return current.getValue(); }
public Object getValue() { HashEntry current = currentEntry(); if (current == null) { throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID); } return current.getValue(); }
public Object getValue() { HashEntry current = currentEntry(); if (current == null) { throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID); } return current.getValue(); }