This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
It has a sort routine that wants a list, and something that implements the Comparator interface:
sort(List<T> list, Comparator<? super T> c)
You *could* create a class that implements Comparator outside the call; new an instance of that class; then pass the new instance of that class. This, however, lets you create a class on the fly (I think it's called an anonymous class; someone will call me on that if I'm wrong, I'm sure), and pass a new instance of that anonymous class as the comparator. The Comparator only wants a way to compare 2 instances of your list.
Hope the above makes sense. I'd have trouble writing it, but I *think* I understand it.
Hello from a new cattle drive guy, btw! I've just sent in 1b recently. I'm sure I'll have lots of questions posted soon.