You manually define the comparison method. The way I prefer to do it is with a comparator object, but that may be too generic for what you're trying to accomplish here.

It's probably fine for you...