I am trying to sort the category arraylist with Collections.sort
method but have no luck with it.
Here is my code:
public class Categories i
You can also use custom comparator:
public class CategoriesComparator implements Comparator {
@Override
public int compare(Category category1, Category category2) {
return category1.getSomeProperty().compareTo(category2.getSomeProperty());
}
}
When you want to compare call this:
Collections.sort(yourListCategories, new CategoriesComparator());
Hope it helps!