Is there a simple and fast way to group elements from an ArrayList in Java? I'm asking if there is already a way without implementing it by my self? something like
Collections.sort(monuments,new objectComparator());
EDIT: I have a list of Objects That have a field called category, this list is shown to the user. I want the objects of category_type==1 to be shown first and so on.
I can't achieve this with comparator, since the way the comparator works is like this:
return int a>0 if the first value is bigger return int a