/** * Creates a new entry object for the ReferenceMap. * * @param parent the parent map * @param next the next entry in the hash bucket * @param hashCode the hash code of the key * @param key the key * @param value the value */ public ReferenceEntry(AbstractReferenceMap<K, V> parent, ReferenceEntry<K, V> next, int hashCode, K key, V value) { super(next, hashCode, null, null); this.parent = parent; if (parent.keyType != HARD) { refKey = toReference(parent.keyType, key, hashCode); } else { this.setKey(key); } if (parent.valueType != HARD) { refValue = toReference(parent.valueType, value, hashCode); // the key hashCode is passed in deliberately } else { this.setValue(value); } }
/** * Creates a new entry object for the ReferenceMap. * * @param parent the parent map * @param next the next entry in the hash bucket * @param hashCode the hash code of the key * @param key the key * @param value the value */ public ReferenceEntry(AbstractReferenceMap<K, V> parent, ReferenceEntry<K, V> next, int hashCode, K key, V value) { super(next, hashCode, null, null); this.parent = parent; if (parent.keyType != HARD) { refKey = toReference(parent.keyType, key, hashCode); } else { this.setKey(key); } if (parent.valueType != HARD) { refValue = toReference(parent.valueType, value, hashCode); // the key hashCode is passed in deliberately } else { this.setValue(value); } }
/** * Creates a new entry object for the ReferenceMap. * * @param parent the parent map * @param next the next entry in the hash bucket * @param hashCode the hash code of the key * @param key the key * @param value the value */ public ReferenceEntry(AbstractReferenceMap<K, V> parent, ReferenceEntry<K, V> next, int hashCode, K key, V value) { super(next, hashCode, null, null); this.parent = parent; if (parent.keyType != HARD) { refKey = toReference(parent.keyType, key, hashCode); } else { this.setKey(key); } if (parent.valueType != HARD) { refValue = toReference(parent.valueType, value, hashCode); // the key hashCode is passed in deliberately } else { this.setValue(value); } }
/** * Sets the value of the entry. * * @param obj the object to store * @return the previous value */ public V setValue(V obj) { V old = getValue(); if (parent.valueType > HARD) { refValue.clear(); refValue = toReference(parent.valueType, obj, hashCode); } else { super.setValue(obj); } return old; }
/** * Sets the value of the entry. * * @param obj the object to store * @return the previous value */ public V setValue(V obj) { V old = getValue(); if (parent.valueType > HARD) { refValue.clear(); refValue = toReference(parent.valueType, obj, hashCode); } else { super.setValue(obj); } return old; }
/** * Sets the value of the entry. * * @param obj the object to store * @return the previous value */ public V setValue(V obj) { V old = getValue(); if (parent.valueType > HARD) { refValue.clear(); refValue = toReference(parent.valueType, obj, hashCode); } else { super.setValue(obj); } return old; }