Sorting Your Own Types
Sorting your own types in Java: Comparable for the natural order, Comparator for the rest, and the two ways a comparator goes wrong.
Sorting objects of your own classes. Sorting numbers needs nothing; sorting invoices needs a decision about what order means, made either once on the type or separately by each caller. It covers the comparison every sort relies on, Comparable and Comparator, building a comparator on two fields, and the two ways a comparator silently lies: overflow and broken consistency. It leaves out sorting algorithms themselves.
Contents
9 cardsnot started