3 ms·
>Collections.sort(data) approach, not the polymorphic data.sort() Since java 8, java.util.List had a sort method and Collections.sort(List) just calls List::so
by tpxl 6y ago
>Collections.sort(data) approach, not the polymorphic data.sort()
Since java 8, java.util.List had a sort method and Collections.sort(List) just calls List::sort. Before that, only the Collections.sort method existed.
At least from java 6 on, java has a SortedSet and SortedMap that accept comparators as constructor parameters, but have no sort methods (So basically data.sort, not collections.sort(data)).
Arrays can of course only be sorted via Arrays.sort, since arrays have no methods.