public class InstanceComparator extends Object implements Comparator, Serializable, RevisionHandler
Arrays and Collections.
Relational values are compared instance by instance with a nested
InstanceComparator.Instance,
Arrays,
Collections,
Serialized Form| Constructor and Description |
|---|
InstanceComparator()
initializes the comparator and includes the class in the comparison
|
InstanceComparator(boolean includeClass)
initializes the comparator
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(Object o1,
Object o2)
compares the two instances, returns -1 if o1 is smaller than o2, 0
if equal and +1 if greater.
|
boolean |
getIncludeClass()
returns TRUE if the class is included in the comparison
|
String |
getRevision()
Returns the revision string.
|
static void |
main(String[] args)
for testing only.
|
void |
setIncludeClass(boolean includeClass)
sets whether the class should be included (= TRUE) in the comparison
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic InstanceComparator()
public InstanceComparator(boolean includeClass)
public void setIncludeClass(boolean includeClass)
includeClass - whether to include the class in the comparisonpublic boolean getIncludeClass()
public int compare(Object o1, Object o2)
compare in interface Comparatoro1 - the first instance to compareo2 - the second instance to comparepublic String getRevision()
getRevision in interface RevisionHandlerCopyright © 2021 University of Waikato, Hamilton, NZ. All rights reserved.