Quote Originally Posted by SilverWarior View Post
Why would you create a new class which incorporates only one method and such method is only used on one place? Wouldn't it be easier to just write your method nested within some other method where it is needed?
Based on my understanding the purpose of classes is the ability to join a group of methods which serves similar purpose into one object so that you can easily reuse this object on different places without the need to redeclare all of those methods.
Java Collections and Arrays has built-in support for sorting. You can either implement the Comparable interface or provide an Comparator object if you need to sort custom objects based on more than one property. This is simply how the Java RT API is designed.

Note also that you may wish to implement more than one method. For Swing GUIs you may e.g. create a bunch of classes implementing listener interfaces handling various input states.
The nice thing with anonymous classes is that an empty method will be created for all those methods you don't implement yourself.

The thing is, that this is common practise in Java, and some Java libraries basically expect you to use anonymous classes. If you don't use anonymous classes you are gonna end up with 100's of small classes (for a larger project) with one or two functions in it designed for one specific case.