- All Implemented Interfaces:
Map.Entry<K,V>
Warning: The methods of ForwardingMapEntry forward indiscriminately to
the methods of the delegate. For example, overriding getValue() alone will not
change the behavior of equals(Object), which can lead to unexpected behavior. In this case, you
should override equals as well, either providing your own implementation, or delegating
to the provided standardEquals method.
Each of the standard methods, where appropriate, use Objects.equals(Object, Object) to test
equality for both keys and values. This may not be the desired behavior for map implementations
that use non-standard notions of key equality, such as the entry of a SortedMap whose
comparator is not consistent with equals.
The standard methods are not guaranteed to be thread-safe, even when all of the
methods that they depend on are thread-safe.
- Since:
- 2.0
- Author:
- Mike Bostock, Louis Wasserman
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class ForwardingObject
toString
-
Constructor Details
-
ForwardingMapEntry
protected ForwardingMapEntry()Constructor for use by subclasses.
-
-
Method Details
-
delegate
Description copied from class:ForwardingObjectReturns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such asForwardingSet.delegate(). Concrete subclasses override this method to supply the instance being decorated.- Specified by:
delegatein classForwardingObject
-
getKey
-
getValue
-
setValue
-
equals
-
hashCode
-
standardEquals
A sensible definition ofequals(Object)in terms ofgetKey()andgetValue(). If you override either of these methods, you may wish to overrideequals(Object)to forward to this implementation.- Since:
- 7.0
-
standardHashCode
protected int standardHashCode()A sensible definition ofhashCode()in terms ofgetKey()andgetValue(). If you override either of these methods, you may wish to overridehashCode()to forward to this implementation.- Since:
- 7.0
-
standardToString
A sensible definition ofForwardingObject.toString()in terms ofgetKey()andgetValue(). If you override either of these methods, you may wish to overrideequals(Object)to forward to this implementation.- Since:
- 7.0
-