I'm wondering if there is a way to sort an Arraylist of custom objects to fit the situation explained below? I'm assuming I'll have to write a custom comparator.

Let's say I have an object class that looks like this:

```
public class Person {
    private String status;    //options: Online, Away, Offline
    private String name;      //Person's name
    private Date date;        //Last signed on

    //basic constructor
    public Person() {
        //set default values
    }

    //constructor to set all variables
    public Person(String s, String n, Date d) {
        status = s;
        name = n;
        date = d;
    }

    //setters & getters for each of the fields
}

```

Sorting based on name and date should be fairly easy. However, I'm wondering how I would sort based on the status? I would like to be able to sort my array based on whether the person is currently **online** and also who is **offline**. I'm not too concerned with who is away.

The above class is just an example class. My actual class has a JLabel set an icon based on the status. The `setText()` remains unused. I thought of a possibility of setting the label to values of 0, 1, and 2 and just using a typical integer comparator but I wasn't sure if that was an advised way of doing it.

Surely I'm missing an obvious solution here, so perhaps a comment or link can provide the necessary information. I know there are tons of 'Sort Arraylist' threads here at SO and I've browsed a lot of them. Most of them are just sorting Strings alphabetically or Integers though.