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 statelessEquivalenceimplementations.StatelessEquivalencerelies 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 otherwiseStringrepresentation of your equivalence would be""(emptyString).See example implementations in the documentation to identity and case insensitive equivalences.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStatelessEquivalence()Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Returnstrueif the given object is also an instance of this equivalence class.inthashCode()Returns a hash code of this equivalence class.StringtoString()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)
Returnstrueif the given object is also an instance of this equivalence class.- Specified by:
equalsin 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:
hashCodein classEquivalence<T>- Returns:
- a hash code of this equivalence class
-
-