If we
need to sort an array of Objects, we can use
Arrays.sort(). If we
need to sort a list of objects, we can useCollections.sort(). Both
these classes have overloaded sort() methods for natural sorting (using
Comparable) or sorting based on criteria (using Comparator).
Collections
internally uses Arrays sorting method, so both of them have same performance
except that Collections take sometime to convert list to array.
No comments:
Post a Comment