I need to sort objects (called items) in an ArrayList by a given field (name, price, etc). What is the easiest way to do this? I'm not sure how to write a comparator, if Collections.sor t is the easiest method. Then that becomes my question: how do I write a comparator that changes which field to compare depending on a value?
Sorting dilemma
Collapse
X
Comment