private Comparator<T> getComparatorChain(TableSortState newSortState) {

		if (newSortState.isUnsorted()) {
			return NO_SORT_COMPARATOR;
		}

		ComparatorLink comparatorLink = new ComparatorLink();
		for (ColumnSortState columnSortState : newSortState) {
			Comparator<T> nextComparator = getComparator(columnSortState);
			comparatorLink.add(nextComparator);
		}

		// Add a comparator to resolve the case where all other comparators return 0 values.
		// This provides some consistency between sorts.
		comparatorLink.add(createLastResortComparator(comparatorLink));
		return comparatorLink;
	}
Creates a 'Chain of Responsibility' object that knows how to do comparisons in a
waterfall fashion (this handles the case where there are multiple columns upon which the
data is sorted).
Ghidra/Framework/Docking/src/main/java/docking/widgets/table/AbstractSortedTableModel.java