Doubt regarding comperators

when previously sir used comperators in sort fn there we were making our own comperators as a fn but here sir is making comperators as a class

@deepakjumani09 Both the approach are correct. If you like you can use the function comparator

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.