diff options
author | Rich Hickey <richhickey@gmail.com> | 2006-08-09 13:57:48 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2006-08-09 13:57:48 +0000 |
commit | be12a746746c53c1f00758df7daa1fa5edc03935 (patch) | |
tree | 02ec20ec0b00c34deddcb7500e7b77ecd54a8767 /src/cli/runtime/APersistentArray.cs | |
parent | ac3c1ae28a18395a15b8a4f85ea2ad90a3e9e540 (diff) |
equals fixes
Diffstat (limited to 'src/cli/runtime/APersistentArray.cs')
-rw-r--r-- | src/cli/runtime/APersistentArray.cs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cli/runtime/APersistentArray.cs b/src/cli/runtime/APersistentArray.cs index de9b548c..b78f502d 100644 --- a/src/cli/runtime/APersistentArray.cs +++ b/src/cli/runtime/APersistentArray.cs @@ -36,7 +36,7 @@ override public bool Equals(Object obj) { if(obj is IPersistentArray)
{
IPersistentArray ma = (IPersistentArray) obj;
- if(ma.count() != count())
+ if (ma.count() != count() || ma.GetHashCode() != GetHashCode())
return false;
for(int i=0;i<count();i++)
{
@@ -48,11 +48,14 @@ override public bool Equals(Object obj) { {
if(!(obj is Sequential))
return false;
- for(ISeq s = seq(), ms = ((IPersistentCollection)obj).seq();s!=null;s = s.rest(), ms = ms.rest())
- {
- if(ms == null || !RT.equal(s.first(),ms.first()))
- return false;
- }
+ ISeq ms = ((IPersistentCollection)obj).seq();
+ for (int i = 0; i < count(); i++, ms = ms.rest())
+ {
+ if (ms == null || !RT.equal(nth(i), ms.first()))
+ return false;
+ }
+ if(ms.rest() != null)
+ return false;
}
return true;
|