When faced with a similar problem the only way to deep-dive the problem and find the set of A, b and c that violates the general contract, is to use loops.
Suppose you have a list
that needs sorting and a custom comparator
that is violating its contract you can find the objects using something like below
for (int i = 0; i < list.size(); i ++) {
for (int j = 0; j < list.size(); j ++) {
for (int k = 0; k < list.size(); k ++) {
Objects a = list.get(i);
Objects b = list.get(j);
Objects c = list.get(k);
if (comparator.compare(a, b) < 0
&& comparator.compare(b, c) < 0
&& comparator.compare(a, c) > 0) {
System.out.print(("Error...1");
System.out.print((a + ", " + i);
System.out.print((b + ", " + j);
System.out.print((c + ", " + k);
}
if (comparator.compare(a, b) > 0
&& comparator.compare(b, c) > 0
&& comparator.compare(a, c) < 0) {
System.out.print(("Error...2");
System.out.print((a + ", " + i);
System.out.print((b + ", " + j);
System.out.print((c + ", " + k);
}
if (comparator.compare(a, b) == 0
&& comparator.compare(b, c) == 0
&& comparator.compare(a, c) != 0) {
System.out.print(("Error...3");
System.out.print((a + ", " + i);
System.out.print((b + ", " + j);
System.out.print((c + ", " + k);
}
}
}
}
I have used this method many times before, especially when you are unable to find the logical errors in your coding through inspection.
I also found this answer on another post that has a general class you can use
https://stackoverflow.com/a/35000727/4019094