The easiest way to sort an array is using the Collections
.sort methods. You have a choice of two methods.
If your object has a natural order, you can consider to make it implement the Comparable
interface (as Manuel suggested). In this case the list can be sorted according to this order.
Another option is to implement a Comparator
an sort the list according to this, using the second sort method.
For example in this case to me the natural order for Users would be to sort by last name and then first name, so I would probably implement a Comparator to sort by first name and last name, however you might feel different (or your use case might be different).