Question: Java problem When sorting a collection of objects that implements the Comparable type, the sorting method compares and rearranges the objects. Explain the role of
Java problem
When sorting a collection of objects that implements the Comparable type, the sorting method compares and rearranges the objects. Explain the role of polymorphism in this situation.
To be very clear:
- define your own Comparable interface
- and your own generic sort method
- Then repeat the process for the java.util.Comparator interface.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
