Comparison Method Violates Its General Contract in Java
IllegalArgumentException: Comparison method violates its general contract! comes from TimSort, not your code. Here is why it fires, and how to fix the comparator.
Core language
Errors & fixes
Apache Kafka
Relational
NoSQL & caching
Errors & fixes
Course · javahandbook.com
Oracle Interview Mastery
200 questions · 19 chapters
View course →Interview courses
IllegalArgumentException: Comparison method violates its general contract! comes from TimSort, not your code. Here is why it fires, and how to fix the comparator.