Package com.globalmentor.model
Class AbstractProxyHashObject
java.lang.Object
com.globalmentor.model.AbstractProxyHashObject
An object that delegates generation of a hash code and determination of equality to other objects. This class is useful for creating keys used in hash
tables, for example. This class keeps references to the proxy objects for its entire lifespan. Hash codes and equality are determined dynamically with each
call. This class is abstract to increase type safety through subclassing.
- Author:
- Garret Wilson
-
Constructor Summary
ConstructorDescriptionAbstractProxyHashObject
(Object... proxiedObjects) Proxied object constructor. -
Method Summary
-
Constructor Details
-
AbstractProxyHashObject
Proxied object constructor. Any or all of the proxied objects may benull
, but the array of objects may not.- Parameters:
proxiedObjects
- The objects to be proxied for generation of hash code and equality determination.- Throws:
NullPointerException
- if the array of proxied objects isnull
.
-
-
Method Details
-
hashCode
public int hashCode()Returns a hash code value for the object. The hash code is determined dynamically from the proxied objects. -
equals
Indicates whether some other object is "equal to" this one. The other object must be a proxy hash object and one of the objects must be an instance of the other to be considered equal. Equality is determined by calling theObject.equals(Object)
of the corresponding proxied objects, in order.
-