Class SortingKey<T,K extends java.lang.Comparable<K>>
- java.lang.Object
-
- com.bakdata.dedupe.candidate_selection.SortingKey<T,K>
-
- Type Parameters:
T- the type of the record.
public final class SortingKey<T,K extends java.lang.Comparable<K>> extends java.lang.ObjectA sorting key allows a dataset to be indexed by a specific (calculated) value of a record, such that duplicates have a higher probability of being in close proximity and thus aCandidateSelectionmay prune the search space drastically.Note to increase the flexibility
-
-
Constructor Summary
Constructors Constructor Description SortingKey(@NonNull java.lang.String name, @NonNull java.util.function.Function<T,K> keyExtractor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)@NonNull java.util.function.Function<T,K>getKeyExtractor()A calculation or simple value access to extract the key.@NonNull java.lang.StringgetName()The name of the sorting key.inthashCode()java.lang.StringtoString()
-
-
-
Method Detail
-
getName
@NonNull public @NonNull java.lang.String getName()
The name of the sorting key. Mostly used for debugging.
-
getKeyExtractor
@NonNull public @NonNull java.util.function.Function<T,K> getKeyExtractor()
A calculation or simple value access to extract the key.Please try to avoid string concatenation and use
CompositeValueunless you really want that semantics. String concatenation will change the sorting order if the strings in the beginning do not have the same length.Example: Consider the two records [Ed, Sheeran] and [Edgar, Poe]. Concatentation will change order
EdgarPoe < EdSheeran.- See Also:
CompositeValue
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-