Comparison method violates its general contract!

ComparatorVerifier is a library for verifying Comparators. Check it out! Java’s standard sorting algorithm, TimSort, is a clever hybrid algorithm that uses a deceptively simple insight about the typical pattern of elements in arrays. Unfortunately the insight is couched deep in mathematical obscurity: Entropy considerations provide a natural estimate of the number of comparisons to sort incompletely shuffled data. From an information theoretic viewpoint, the number of comparisons needed to sort a permutation is an upper bound on the Kolmogorov complexity of the permutation....

4 April 2025 · 2243 words

Using Jackson Deduction to Simplify Deserialisation

I find the documentation for Jackson is on the terse side, and dare I say obstructively self-referential. If you aren’t moved fully to tears by the Javadoc entries for JsonTypeInfo.As, you deserve an ACM award. In short: I need a helpful and up-to-date guide, so I’m writing one. What are we trying to do? We often want to vary the content of our JSON. It’s integral to the Envelope pattern for instance....

30 May 2024 · 465 words