No. A Comparator is like a scale with two trays that takes two objects.
![]()
An ArrayList has a method .sort(). So you say “sort all these apples by weight” or “sort all these cars by hue” or “sort all these events by date” – and you hand the sort function a scale to work with, your Comparator. The Comparator takes just two apples and returns 0 if they are equal, or a negative or positive number if the first or second is greater. sort() algorithm can then use this to sort all the apples.
Same thing with Events. A Comparator compares two, and reports the order – by most new cases, for example. Or by total, etc. Pass a Comparator to ArrayList sort() and it sorts all Events.
Same thing for Estado. A Comparator could compare by anything – for example, the value of “new” in the most recent event of an Estado – and return which of two Estados has more. The comparator then used by ArrayList estados.sort() to sort the whole list.
Also note that sorting isn’t destructive if you can sort back.