In some situations the collection.sort() algoritm fails in compareTo()
with a: java.lang.IllegalArgumentException: Comparison method violates
its general contract!, due to a more strict validation of the compare
contract.
This strict validation was introduced in java 1.7.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=
6804124
This fix should prevent the sorting from crashing.
Change-Id: I64230e7f62f83c99d7a6274964bb2988ae843826
|| (mOrder == DEFAULT_ORDER && another.mOrder != DEFAULT_ORDER)) {
// Do order comparison
return mOrder - another.mOrder;
+ } else if (mTitle == another.mTitle) {
+ // If titles are null or share same object comparison
+ return 0;
} else if (mTitle == null) {
return 1;
} else if (another.mTitle == null) {