Class Canonicalizer
java.lang.Object
org.cojen.tupl.util.Canonicalizer
Implements a specialized cache for supporting object canonicalization. It behaves like the
String.intern
method, but this class supports any kind of object.
Objects that do not customize the hashCode
and equals
methods don't make
sense to be canonicalized because each instance will be considered unique. The object
returned from the apply
method will always be the same as the one passed in.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<A> A
apply
(A obj) Returns the original object or another one which is equal.
-
Constructor Details
-
Canonicalizer
public Canonicalizer()
-
-
Method Details
-
apply
public <A> A apply(A obj) Returns the original object or another one which is equal.
-