Hi guys
I am working on a project and I've come to a stage where I need to compare two integer values.
Here is the code for the method:
public Domestic findDomProperty(int reference) {
Domestic d1;
int indexLocation = -1;
for (int i = 0; i < super.size(); i++) {
d1 = (Domestic)super.elementAt(i);
if (d1.getReference().equal(reference)) {
indexLocation = i;
break;
}
}
if (indexLocation == -1) {
return null;
}
else {
return (Domestic)super.elementAt(indexLocation);
}
}
I get the error on the compare link:
if (d1.getReference().equal(reference)) {
The error (in NetBeans 6.5) say:
"int cannot be dereferenced"
gerReference returns an int and I'm guessing { .equal() } does not work on ints ! (please correct me if I'm wrong).
What I want to know is .. what do I use instead of { .equals() } to compare the two integer values.
I would
greatly appreciate any help.
Thank You.
Edited by: Ciwan86 on Mar 21, 2009 6:56 PM
Edited by: Ciwan86 on Mar 21, 2009 6:56 PM