What may be the purpose of comparing numbers with a custom comparator in Java?

Viewed 47

I have a homework assignment that includes creating min() and max() methods for a custom set class of Integers that take Comparator<Integer> objects as parameters. I've also seen some similar practice problems online and while I don't have any problems implementing this, I don't understand the reason of doing so.

So, are there any practical applications of using custom Comparators to compare numbers? I would highly value any examples.

0 Answers
Related