Implement equals() and hashCode().

This commit is contained in:
Michael Bayne
2004-07-13 10:39:37 +00:00
parent f376eadd7c
commit 7b24a1b606
@@ -1,5 +1,5 @@
//
// $Id: Resource.java,v 1.6 2004/07/07 16:17:01 mdb Exp $
// $Id: Resource.java,v 1.7 2004/07/13 10:39:37 mdb Exp $
package com.threerings.getdown.data;
@@ -130,6 +130,26 @@ public class Resource
}
}
/**
* If our path is equal, we are equal.
*/
public boolean equals (Object other)
{
if (other instanceof Resource) {
return _path.equals(((Resource)other)._path);
} else {
return false;
}
}
/**
* We hash on our path.
*/
public int hashCode ()
{
return _path.hashCode();
}
/**
* Returns a string representation of this instance.
*/