How do you sort a HashMap based on the values?
A. Enable the Comparator interface and override the compare method.
B. Make use of the Comparator and Comparable interfaces.
C. It is not conceivable.
D. Adherence to the Comparator interface and override the compareTo methoD.
Answer:A
How do you sort a HashMap based on the values?
A. Enable the Comparator interface and override the compare method. B. Make use of the Comparator and Comparable interfaces. C. It is not conceivable. D. Adherence to the Comparator interface and override the compareTo methoD.
Explanation: Override the Comparator interface's compare function and implement it.