473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Comparator Interface

Difference between compare() & equals() with an example....
Oct 12 '07 #1
3 1332
dmjpro
2,476 2GB
Difference between compare() & equals() with an example....
If you implement "first one", then it will be OK.
For details see API doc.

Debasis Jana.
Oct 12 '07 #2
If you implement "first one", then it will be OK.
For details see API doc.

Debasis Jana.
I wnt d diffrence bet 'em....
Oct 12 '07 #3
JosAH
11,448 Expert 8TB
I wnt d diffrence bet 'em....
The equals() method just checks whether two objects are equal or not. The compare()
method defines an 'order' of elements e1 < e2 < e3 ... en. If e1,compare(e2)
is less than zero then e1 < e2; if it returns greater than zero then e2.compare(e1)
returns less than zero so e2 < e1. Otherwise both are considered equal and then
e1.equals(e2) == e2.equals(e1) == true.

The compare() method imposes a 'stronger' relation between two objects than
the equals() method does.

kind regards,

Jos
Oct 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: bdinmstig | last post by:
Hi. I need an implementation of java.util.Comparator with the following features: 1. Given a (mutable) java.util.List instance of unspecified size at construction time. 2. That List instance...
7
by: Christopher Jeris | last post by:
I am relatively new to JavaScript, though not to programming, and I'm having trouble finding the idiomatic JS solution to the following problem. I have a table with (say) fields f1, f2, f3. I...
2
by: Steven T. Hatton | last post by:
While thunbing through _C++ Templates, The Complete Guide_ (reckon I aught to read it?) I came across a discussion of using templates to "unroll" loops. I thought that looked like a good idea, so...
17
by: Trent Buck | last post by:
The fourth argument is a comparator that returns `an integer less than, equal to, or greater than zero' depending on the ordering of its arguments. If I don't care about the order and simply...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
2
by: Random | last post by:
I need to apply a filterparameter to a result set in my GridView based on the selection in a DropDownList control. I want to use the integer SelectedValue property of the DropDownList to filter...
6
by: furqan shaikh | last post by:
hi can any one help me in making the c++ files comparator. i m in data structure course and i am gonna make project on c++ code comparator. plz help me in making it.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.