Package io.timeandspace.collect
Class StatelessEquivalence<T>
- java.lang.Object
-
- io.timeandspace.collect.Equivalence<T>
-
- io.timeandspace.collect.StatelessEquivalence<T>
-
public abstract class StatelessEquivalence<T> extends Equivalence<T>
Base class for statelessEquivalence
implementations.StatelessEquivalence
relies on the fact that your equivalence class, which extend it, don't have subclasses in turn, therefore it is strongly recommended to declare your equivalence class asfinal
.Override
toString()
if implementation is anonymous and you want to log or pretty print it, because otherwiseString
representation of your equivalence would be""
(emptyString
).See example implementations in the documentation to identity and case insensitive equivalences.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
StatelessEquivalence()
Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Returnstrue
if the given object is also an instance of this equivalence class.int
hashCode()
Returns a hash code of this equivalence class.String
toString()
Returns simple name of this equivalence class,getClass().getSimpleName()
.-
Methods inherited from class io.timeandspace.collect.Equivalence
caseInsensitive, charSequence, defaultEquality, entryEquivalence, equivalent, hash, identity, nullableEquivalent, nullableHash
-
-
-
-
Method Detail
-
equals
public boolean equals(Object o)
Returnstrue
if the given object is also an instance of this equivalence class.- Specified by:
equals
in classEquivalence<T>
- Returns:
- if the given object is also an instance of this equivalence class
-
hashCode
public int hashCode()
Returns a hash code of this equivalence class.- Specified by:
hashCode
in classEquivalence<T>
- Returns:
- a hash code of this equivalence class
-
-