first, following documentation i’ve created this method in Estado class, since i wanted to see states with most cases first:
@Override int compareTo(Estado other) {
return this.maxTC - other.maxTC;
}
and in setup, i’ve sorted and reversed the ArrayLists after instatiated them all
Collections.sort(estados);
Collections.reverse(estados);
Collections.sort(activeCities);
Collections.reverse(activeCities);
i tend to believe that if i’d inverted the calculus in the method i wouldn’t need to reverse the sorted list. but since it’s working as i wanted, i’ve stopped to try that.
return other.maxTC - this.maxTC ;
EDIT:
also, i’ve imported java collection library.
import java.util.Collections;