Implement equals() and hashCode().
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user