- java.lang.Object
-
- com.aoapps.collections.IdentityKey<T>
-
public class IdentityKey<T> extends Object
Allows any object to be used as a hash key, with identity used forhashCode()andequals(java.lang.Object). They may be used, for example, to haveIdentityHashMapsemantics withWeakHashMapreferences.Supports
nullvalue, which may allownullkeys in maps that otherwise do not supportnullkeys.- Author:
- AO Industries, Inc.
-
-
Field Summary
Fields Modifier and Type Field Description static IdentityKey<?>NULL
-
Constructor Summary
Constructors Constructor Description IdentityKey(T value)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)TgetValue()inthashCode()static <T> IdentityKey<T>of(T value)Gets the identity key for the given value orNULLfor anullvalue.static <T> IdentityKey<T>ofNull()Gets the identity key that representsnull.StringtoString()
-
-
-
Field Detail
-
NULL
public static final IdentityKey<?> NULL
-
-
Constructor Detail
-
IdentityKey
@Deprecated public IdentityKey(T value)
Deprecated.
-
-
Method Detail
-
ofNull
public static <T> IdentityKey<T> ofNull()
Gets the identity key that representsnull.
-
of
public static <T> IdentityKey<T> of(T value)
Gets the identity key for the given value orNULLfor anullvalue.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObject- See Also:
System.identityHashCode(java.lang.Object)
-
getValue
public T getValue()
-
-