Hi, I am trying to compare two objects, but it is not working correctly. Please help.
/**
* Compares theObject with <CODE>this</CODE> object for
* equivalence. Do not concern yourself with runtime
* efficiency.
* @param theObject to be compared with this object
* @return true if theObject is equivalent to this
* object.
*/
@Override public
boolean equals( Object theObject ){
if (theObject == null) return false;
if(!(theObject instanceof BoundedBag)) return false;
if (this == theObject) return true;
BoundedBag obj = (BoundedBag) theObject;
if( this.size() != obj.size() ) return false;
// Fill in the remainder of the code.
BoundedBag extra = (BoundedBag)thisObject;
if(thisObject.equals (theObject))
return true;
else
return false;
}