Make sure MediaType.sortBySpecificity() always returns a properly ordered list

Collections.sort() does not do this because it assumes a comparator that
implements a complete order, and the specificity-comparator is a partial
ordering.
More efficient implementation of CollectionUtils.sortTopologically