File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
diff b/w compare() and compareTo()
Joined: Jan 23, 2006
Feb 01, 2006 23:56:00
what is difference between compare() and compareTo()....
Thanks advance who ever answers this question.
Joined: Nov 24, 2005
Feb 02, 2006 00:10:00
which class ?
All roads lead to JavaRanch
Joined: Sep 16, 2005
Feb 02, 2006 05:18:00
Q: What's the diference between java.util.Comparator and java.lang.Comparable?
A: A comparator compares two given objects, so there are three references involved:
if (String.CASE_INSENSITIVE_ORDER.compare(string1, string2)<0)...
A comparable compares (itself) to another object, so there are two refernces involved:
There is no emoticon for what I am feeling!
I agree. Here's the link:
subject: diff b/w compare() and compareTo()
question about comparable and comparator
Using a Comparator in Collections
JDK 1.5 Collections.sort
About Comparator Interface
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014