Scenario
I got an Object which has a startDate
and an endDate
. If both are not null
the timeDiff
will be set, calculating the time difference between these two dates in Long
.
Use Case
All Objects with a timeDiff
should be first, rest last.
Comparator
HFehlerProtPairComparator
if (sortFieldName.equals(HFehlerProtPairFields.EREIGNISDATUM_DIFFERENZ.getName())) {
if (null != firstO.getStartDate() && null != firstO.getEndDate()
&& null != secondO.getStartDate() && null != secondO.getEndDate()) {
compare = firstO.getTimeDiff().compareTo(secondO.getTimeDiff());
} else {
compare = -1;
}
}
I have no idea what I'm missing and debugging won't help me here. I tried verifying it on paper and I don't see my error there too.
Call Hierarchy
comp = new HFehlerProtPairComparator(field.getName(), SortType.ASC.name());
Error ==> Collections.sort(unsortedHFehlerProtPairList, comp);
Stack
at java.util.TimSort.mergeHi(TimSort.java:899)
at java.util.TimSort.mergeAt(TimSort.java:516)
at java.util.TimSort.mergeForceCollapse(TimSort.java:457)
at java.util.TimSort.sort(TimSort.java:254)
at java.util.Arrays.sort(Arrays.java:1512)
at java.util.ArrayList.sort(ArrayList.java:1454)
at java.util.Collections.sort(Collections.java:175)
at uebergreifendeereignis.UeHFehlerProtPairListController.sortBySortMap(UeHFehlerProtPairListController.java:360)