Try to fix "Comparison method violates its general contract" error.

This commit is contained in:
LevelX2 2016-06-18 12:55:54 +02:00
parent 1bee035aaa
commit 663c6fe1e9

View file

@ -251,20 +251,28 @@ class TableListSorter implements Comparator<Table> {
} else { } else {
return two.getEndTime().compareTo(one.getEndTime()); return two.getEndTime().compareTo(one.getEndTime());
} }
} else if (one.getEndTime() != null) {
return -1;
} }
if (two.getStartTime() != null) { if (two.getStartTime() != null) {
if (one.getStartTime() == null) { if (one.getStartTime() == null) {
return 1; return 1;
} else { } else {
return two.getStartTime().compareTo(one.getStartTime()); return two.getStartTime().compareTo(one.getStartTime());
} }
} else if (one.getStartTime() != null) {
return -1;
} }
if (two.getCreateTime() != null) { if (two.getCreateTime() != null) {
if (one.getCreateTime() == null) { if (one.getCreateTime() == null) {
return 1; return 1;
} else { } else {
return two.getCreateTime().compareTo(one.getCreateTime()); return two.getCreateTime().compareTo(one.getCreateTime());
} }
} else if (one.getCreateTime() != null) {
return -1;
} }
return 0; return 0;
} }