summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--java/util/concurrent/CopyOnWriteArrayList.java19
2 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index ba2660eca..356ae061c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-26 Mario Torre <neugens@aicas.com>
+
+ * java/util/concurrent/CopyOnWriteArrayList.java (equals): removed
+ useless local variable.
+ (hashCode): new method.
+
2008-03-25 Mario Torre <neugens@aicas.com>
* java/util/concurrent/CopyOnWriteArrayList.java (clone): clone method
diff --git a/java/util/concurrent/CopyOnWriteArrayList.java b/java/util/concurrent/CopyOnWriteArrayList.java
index aec1f8dc8..ac3b95be7 100644
--- a/java/util/concurrent/CopyOnWriteArrayList.java
+++ b/java/util/concurrent/CopyOnWriteArrayList.java
@@ -705,8 +705,6 @@ public class CopyOnWriteArrayList<E>
if (this == o)
return true;
- boolean _equals = false;
-
// let's see if 'o' is a list, if so, we need to compare the elements
// as returned by the iterator
if (o instanceof List)
@@ -723,10 +721,21 @@ public class CopyOnWriteArrayList<E>
return false;
}
- _equals = true;
+ return true;
}
-
- return _equals;
+
+ return false;
+ }
+
+ public int hashCode()
+ {
+ // see http://java.sun.com/6/docs/api/java/util/List.html#hashcode()
+ int hashcode = 1;
+ for (E element : this)
+ {
+ hashcode = 31 * hashcode + (element == null ? 0 : element.hashCode());
+ }
+ return hashcode;
}
/**