Say I had an enumeration called Planets in which there were VENUS, EARTH and MARS. I will have many lists of arrays that will contain no more than one type. I want every list of arrays always sorted using VENUS, EARTH and MARS.
Should I use a comparator for this? Is there a way to keep them sorted automatically after insertion, or do I need to call sorting after each insertion? Do I need to store an int value inside each type in order to distinguish their order?
Suggest alternative advice if you have, thanks.
source
share