Section 16.7 Collections Methods

• Algorithms sort (p. 697), binarySearch, reverse (p. 702), shuffle (p. 700), fill (p. 702), copy, addAll (p. 693), frequency and disjoint operate on Lists. Algorithms min and max (p. 703) operate on Collections.

• Algorithm addAll appends all the elements in an array to a collection (p. 706), frequency (p. 706) calculates how many elements in the collection are equal to the specified element, and disjoint (p. 706) determines whether two collections have elements in common.

• Algorithms min and max find the smallest and largest items in a collection.

• The Comparator interface (p. 697) provides a means of sorting a Collection’s elements in an order other than their natural order.

Collections method reverseOrder ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.