I thought of doing this by putting all of the sets in a list that would then be in a map, where the key is the size. I know the maximum size that a set could be(given to me), so I can just iterate between 0 and that number, get each list and then iterate through each list and put each set in an arraylist.
However, this seems horrifically clunky - is there a better way of doing this? Is there some way I can do a comparator function based on size?
Thanks