I have the code:
private ArrayList<Casa> casas = new ArrayList<Casa>();
And when I add the data I want it to be added in alphabetical order.
I have tried with
Collection.sort(casas);
But I get an error like this:
Required type: List<T
Provided: ArrayList<Home
And I don't know how to solve it.
You can make use of Comparator to sort alphabetically by some attribute of your House class
Example:
exit: