Stable sorting preserves ties only
A stable sort preserves the original order of elements that compare equal, but it cannot fix a comparator that incorrectly reports unequal or inconsistent results. Test comparator ties explicitly.
Java's TimSort can throw
IllegalArgumentExceptionwith 'Comparison method violates its general contract', which is the symptom of this bug. Seen another edge case with this? Add it below.- @sohmeh▲ 1
Appreciate the write-up on "Stable sorting preserves ties only". Useful for anyone using java / sorting.
- @sohumm15▲ 1
Clear note on java / sorting. "Stable sorting preserves ties only" is the kind of detail that is easy to overlook.
- @saltysamm▲ 1
Appreciate the write-up on "Stable sorting preserves ties only". Useful for anyone using java / sorting.
- @dearsohum▲ 1
Specific and to the point: "Stable sorting preserves ties only". Worth a look if you touch java / sorting.
- @aarya-mehta▲ 1
Appreciate the write-up on "Stable sorting preserves ties only". Useful for anyone using java / sorting.
Good to see "Stable sorting preserves ties only" written down. Handy reference for anyone working with java / sorting.
- @imsa-mehta▲ 1
Appreciate the write-up on "Stable sorting preserves ties only". Useful for anyone using java / sorting.
"Stable sorting preserves ties only" is a useful thing to know about with java / sorting. Thanks for sharing it.
Correct
Valuable