今天遇到了一个这样的bug

02-20 20:31:20.202 22141 22214 E AndroidRuntime: FATAL EXCEPTION: LOAD_TIEBA_THREAD
02-20 20:31:20.202 22141 22214 E AndroidRuntime: Process: com.darin.tiebasign, PID: 22141
02-20 20:31:20.202 22141 22214 E AndroidRuntime: java.lang.IllegalArgumentException: Comparison method violates its general contract!
02-20 20:31:20.202 22141 22214 E AndroidRuntime:    at java.util.TimSort.mergeLo(TimSort.java:761)
02-20 20:31:20.202 22141 22214 E AndroidRuntime:    at java.util.TimSort.mergeAt(TimSort.java:497)
02-20 20:31:20.202 22141 22214 E AndroidRuntime:    at java.util.TimSort.mergeCollapse(TimSort.java:424)
02-20 20:31:20.202 22141 22214 E AndroidRuntime:    at java.util.TimSort.sort(TimSort.java:210)
02-20 20:31:20.202 22141 22214 E AndroidRuntime:    at java.util.Arrays.sort(Arrays.java:1998)
02-20 20:31:20.202 22141 22214 E AndroidRuntime:    at java.util.Collections.sort(Collections.java:1900)
02-20 20:31:20.202 22141 22214 E AndroidRuntime:    at com.darin.tiebasign.interactor.TiebaLoadInteractorImpl.LoadTiebaFinish(TiebaLoadInteractorImpl.java:329)
02-20 20:31:20.202 22141 22214 E AndroidRuntime:    at com.darin.tiebasign.interactor.TiebaLoadInteractorImpl.getTiebaInfosFromJson(TiebaLoadInteractorImpl.java:273)

这是个啥? 这里加个图

Google 了一下,在stackoverflow 上找到一篇类似的问题,并了解到该如何解决;

java.lang.IllegalArgumentException: Comparison method violates its general contract

记录一下: 重写 compareTo 时, 两者比较一定要是可传递性的If A == B and B == C, then A must be equal to C.