I'm trying to sort a list by frequency.
List myList = ["a", "b", "c", "d", "e", "f", "d", "d", "e"];
My expected output would be that the list is sorted on frequency & has no duplicated elements.
(myList has 3x "d" and 2x "e").
List output = ["d", "e", "a", "b", "c", "f"];
What's the most efficient way to do it?
Thanks in advance!
Is it also possible to do the same system with a List of Maps/Objects?
List myList2 = [{"letter": a, "info": myInfo}, {"letter": b, "info": myInfo}, ...]