Quote (furbyjs @ Nov 19 2014 09:42pm)
I looked at it, but I don't understand the jargon. I have no idea what it means by "Natural Ordering," and I saw it talking about Comparator, but didn't know if that was something other than the object's compareTo method. That's why I posted here, because I need someone to simplify it =/
if you noticed, 'natural ordering' is a link that refers to Comparable interface, which is where you get compareTo from.
Comparator is an alternative to Comparable. Comparable works great for objects if you only need one type of sort or if its sort order is intuitive/obvious. eg: String, Integer, etc. but what if you have an object like an Item which has itemId, itemcode, itemdescription, and it's tied to different stores? you might want it sorted in many different ways depending on how it's used, so you'd use Comparators for it.