I have a List of entities, and I want to be able to sort the List using a custom .sort() function which takes as parameter the way the list should be sorted. e.g.
repo.sort(sort by field)
repo.sort(sort by field but ascending)
repo.sort(sort by field descending and by another field ascending)
My train of thought was that i should make a sort function that gets overloaded and depending on the number of parameters it should behave a certain way, but i feel that i am overcomplicating it and was wondering if there is a simpler way. Thank you in advance.