For lists, we use the Collections.sort(List) method. What if we want to sort a HashSet?
Collections.sort(List)
HashSet
This simple command did the trick for me:
myHashSet.toList.sorted
I used this within a print statement, so if you need to actually persist the ordering, you may need to use TreeSets or other structures proposed on this thread.