When sort method works upon only Lists, I feel keeping it in Collections class is somewhat buggy. Shouldn't there be a separate class dedicated to Lists? Maybe AbstractList or something like ListUtil.. ?
Collections
is a helper class for all collections regardless of their type. In addition to method for the List
there are methods specific to Map
s, SortedMap
s, SortedSet
s, and, of course, Collection
s.
Although making a separate helper for lists alone would be a justifiable choice, using a single helper class as a single place for all collection helpers makes perfect sense as well: it makes it easier for developers to remember where the methods are, because only one class is there.
Note that starting with Java-8 you can call sort
as a default method implementation on List<T>
, making the implementation even easier to locate.