CodePudding user response:
Because you call sort method can take advantage of the Comparable interface compareto method, are compared, and the element size as long as you can compare two elements size, no matter in that sorting algorithm, can be sorted