jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r782694 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
Date Mon, 08 Jun 2009 16:21:43 GMT
Author: stefan
Date: Mon Jun  8 16:21:43 2009
New Revision: 782694

URL: http://svn.apache.org/viewvc?rev=782694&view=rev
Log:
JCR-2132: o.a.j.core.state.ChildNodeEntries does not override equals(Object) and hashCode()
methods

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java?rev=782694&r1=782693&r2=782694&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
Mon Jun  8 16:21:43 2009
@@ -314,7 +314,7 @@
         return result;
     }
 
-    //-------------------------------------------< unmodifiable List view >
+    //-----------------------------------------------< unmodifiable List view >
     public boolean contains(Object o) {
         if (o instanceof ChildNodeEntry) {
             return entries.containsKey(((ChildNodeEntry) o).getId());
@@ -447,7 +447,32 @@
         throw new UnsupportedOperationException();
     }
 
-    //------------------------------------------------< Cloneable support >
+    //-------------------------------------------< java.lang.Object overrides >
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof ChildNodeEntries) {
+            ChildNodeEntries other = (ChildNodeEntries) obj;
+            return (nameMap.equals(other.nameMap)
+                    && entries.equals(other.entries)
+                    && shared == other.shared);
+        }
+        return false;
+    }
+
+    /**
+     * Returns zero to satisfy the Object equals/hashCode contract.
+     * This class is mutable and not meant to be used as a hash key.
+     *
+     * @return always zero
+     * @see Object#hashCode()
+     */
+    public int hashCode() {
+        return 0;
+    }
+
+    //----------------------------------------------------< Cloneable support >
 
     /**
      * Returns a shallow copy of this <code>ChildNodeEntries</code> instance;
@@ -502,7 +527,7 @@
         }
     }
 
-    //----------------------------------------------------< inner classes >
+    //--------------------------------------------------------< inner classes >
     class EntriesIterator implements ListIterator {
 
         private final OrderedMapIterator mapIter;



Mime
View raw message