Clean Java

There is always a bigger game

Comparable VS Comparator in Java

with one comment

This post is moved to


Written by cleanjava

June 21, 2011 at 11:21 pm

One Response

Subscribe to comments with RSS.

  1. good example but primary advantage of Comparable over Comparator in Java is If any class implement Comparable interface in Java then collection of that object either List or Array can be sorted automatically by using Collections.sort() or Array.sort() method and object will be sorted based on there natural order defined by CompareTo method.


    August 25, 2011 at 7:47 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: