I have this thing where there an ArrayList of many classes. And when I add/update/remove some class in that list, I need to know from which row was an object removed/added/updated. OK, maybe that part I could do myself by implementing a sort. But next part I don't really know how or maybe its lack of coffee.
Each class has 3 values - long date, int size and float cost. At the end, the first element in the list has to have earliest date w/ the biggest size and best cost. In SQL it would look like this: ORDER BY date ASC, size DESC, price DESC.
Frankly, I have no clue how its done Maybe someone can suggest how to sort object w/ multiple criteria in general? It'd really help
I assume you mean many instances all of the same class. If not, please elaborate.
I don't understand your first requirement. When you do a list.remove(obj) you want to know the index of the object removed? You could doTo sort on multiple attributes of the objects you can have the objects in the ArrayList implement Comparable and use java.util.Collections.sort(list) or create a Comparator and use the other form: sort(list, comparator).
Since you're posting to the advanced forum, I'll leave this as an exercise to you. It is fairly straight-forward to do a multi-column sort with the JavaDocs. If you get stuck, post again.