Class RecordComparator
java.lang.Object
com.northconcepts.datapipeline.core.RecordComparator
- All Implemented Interfaces:
Cloneable,Comparator<Record>
Orders records by a list of fields, each ascending or descending with an optional
Collator; when no fields are
added, records are compared on all their fields by name.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a copy of the given comparator with its own copies of the field comparators. -
Method Summary
Modifier and TypeMethodDescriptionAdds an ascending comparison on the given field name orFieldPathexpression.Adds an ascending or descending comparison on the given field name orFieldPathexpression.Adds a comparison on the given field name orFieldPathexpression that uses the collator for string values.clone()intget(int index) Returns the comparator for the field added at the given 0-based index.intgetCount()Returns the number of fields added for comparison.remove(int index) Clears the field comparisons so records are compared on all their fields.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
cacheFieldIndexes
protected boolean cacheFieldIndexes
-
-
Constructor Details
-
RecordComparator
public RecordComparator() -
RecordComparator
Creates a copy of the given comparator with its own copies of the field comparators.
-
-
Method Details
-
clone
-
add
Adds an ascending comparison on the given field name orFieldPathexpression. -
add
Adds an ascending or descending comparison on the given field name orFieldPathexpression. -
add
Adds a comparison on the given field name orFieldPathexpression that uses the collator for string values. -
getCount
public int getCount()Returns the number of fields added for comparison. -
get
Returns the comparator for the field added at the given 0-based index. -
remove
-
removeAll
Clears the field comparisons so records are compared on all their fields. -
compare
- Specified by:
comparein interfaceComparator<Record>
-