Array Comparison The compare() method of the Comparable<E> interface allows two objects to be compared. The comparison relationship is generalized…
15.9 Map Implementations Figure 15.3, p. 787, shows four implementations of the Map<K, V> interface found in the java.util package:…
The TreeSet<E> Class The TreeSet<E> class implements the NavigableSet<E> interface and thereby the SortedSet<E> interface. By default, operations on a…
The static method comparing() extracts a comparator that uses the getName() method of the Task class, and the default method…
Comparing Arrays The java.util.Arrays class provides a rich set of static methods for comparing arrays of primitive data types and…
Searching in Collections The Collections class provides two static methods for finding elements in sorted lists. Click here to view…
Miscellaneous Utility Methods in the Arrays Class The methods toString() and fill() (Example 15.10, Example 15.11) have previously been used…
Advanced Key-Based Operations The following methods for a map take a function (implemented by a lambda expression or a method…
15.5 Sorted Sets and Navigable Sets Before reading this subsection, it is a good idea to review the Comparable<E> interface…
Ordering Elements in Lists In order to sort the elements of a collection by their natural ordering or by another…