chxxnxr pfp
chxxnxr
@chxxnxr
🧵 Java Sorting Stability To achieve stable sort (eg Arrays.sort) a stable sorting algorithm like merge sort is used. However, this relies on the Comparator to provide an ordering. If sorting higher-order objects that have a Comparator implementation that isn’t able to provide a total order, you are not guaranteed to have stable ordering between sorts. It’s useful to have stable sorting for reproducibility and testing. Reproducibility means we can simulate and replay events that may have happened in production. Testing means we can have unit tests or integration tests that have an expected result
0 reply
0 recast
0 reaction