So, I put up with the fact that I could not reliably use the list order, because sleep mode changes it, and everyone says that do not do this, so I added the field to my class as a position. I have:
@Entity
class Procedure {
...
int procedureId;
List<Task> tasks;
...
}
@Entity
class Task {
...
int taskId;
int position;
}
Now I do not know how to approach the interaction with the list. Should I just sort it by position, when I first get it from db and start working with it, and then I can leave all the code change code that I already wrote, and then just reset all positions to save, order the list so that I could have resorted when i get back?
SKIP TO THE ACTUAL QUESTION HERE:
This seems to be the best approach, but HOW do I sort the list by the property of the objects in the collection?