Java error: Comparison method violates its general contract
The exception message is actually pretty descriptive. The contract it mentions is transitivity: if A > B and B > C then for any A, B and C: A > C. I checked it with paper and pencil and your code seems to have few holes: if (card1.getRarity() < card2.getRarity()) { return 1; you do … Read more