The collections framework provides several high-performance algorithms for manipulating collection elements. These algorithms are implemented as static methods of class Collections (Fig. 19.7). Algorithms sort, binarySearch, reverse, shuffle, fill and copy operate on Lists. Algorithms min, max, addAll, frequency and disjoint operate on Collections.
|sort||Sorts the elements of a List.|
|binarySearch||Locates an object in a List.|
|reverse||Reverses the elements of a List.|
|shuffle||Randomly orders a List’s elements.|
|fill||Sets every List element to refer to a specified object.|
|copy||Copies references from one List into another.|
|min||Returns the smallest element in a Collection.|