title: Java comparing custom objects
body: <p>I've got ArrayList of custom objects. I need to implement sorting by different parametres, i.e. year and price both ascending and descending. What's the best way to do it? I thought about implementing <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html" rel="nofollow">Comparator</a> and passing sort mode to constructor during  instantiation of comparator. Is that good idea?</p>