@Override public int compare(Result<T> a, Result<T> b) { int cmp = comparator.compare(a.output, b.output); if (cmp == 0) { return a.input.compareTo(b.input); } else { return cmp; } }