Why not? Just write a class that implements Comparable, implemented as you want to sort. See Object Ordering