Question: Step 1 : Inspect IntComparer.java and StringComparer.java Java's built - in java.util.Comparator interface is a functional interface: an interface that has only one abstract method.

Step 1: Inspect IntComparer.java and StringComparer.java
Java's built-in java.util.Comparator interface is a functional interface: an interface that has only one abstract method. Comparator's abstract method is named compare() and takes two arguments for two items to compare. compare(a, b) returns an integer:
greater than 0 if a > b,
less than 0 if a < b, or
equal to 0 if a == b.
Comparator is a generic interface. The compare() method's parameters are both type T. Class IntComparer implements Comparator and so implements compare() to compare two integers. Class StringComparer implements Comparator and so implements compare() to compare two strings.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!