[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/collection ...

Ben Wang bwang at jboss.com
Sun Sep 17 03:50:32 EDT 2006


  User: bwang   
  Date: 06/09/17 03:50:32

  Modified:    src-50/org/jboss/cache/pojo/collection  CachedMapImpl.java
  Log:
  JIRA JBCACHE-765 Collection equals
  
  Revision  Changes    Path
  1.14      +9 -14     JBossCache/src-50/org/jboss/cache/pojo/collection/CachedMapImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedMapImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/collection/CachedMapImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- CachedMapImpl.java	6 Sep 2006 13:36:23 -0000	1.13
  +++ CachedMapImpl.java	17 Sep 2006 07:50:31 -0000	1.14
  @@ -324,8 +324,7 @@
      public int hashCode()
      {
         int result = 0;
  -      for (Iterator i = entrySet().iterator(); i.hasNext();)
  -      {
  +      for (Iterator i = entrySet().iterator(); i.hasNext();) {
            result += i.next().hashCode();
         }
         return result;
  @@ -335,26 +334,22 @@
      {
         if (object == this)
            return true;
  -      if (!(object instanceof Map))
  +      if (object == null || !(object instanceof Map))
            return false;
         Map map = (Map) object;
         if (size() != map.size())
            return false;
  -      for (Iterator i = entrySet().iterator(); i.hasNext();)
  -      {
  +      for (Iterator i = entrySet().iterator(); i.hasNext();) {
            Entry entry = (Entry) i.next();
            Object value = entry.getValue();
            Object key = entry.getKey();
  -         if (value == null)
  -         {
  -            if (! (map.get(key) == null && map.containsKey(key)))
  -            {
  +         if (value == null) {
  +            if(! (map.get(key) == null && map.containsKey(key))) {
                  return false;
               }
  -         } else
  -         {
  -            if (map.get(key) == null
  -                    || !map.containsKey(key))
  +         }
  +         else {
  +            if (! value.equals(map.get(key)))
                  return false;
            }
         }
  
  
  



More information about the jboss-cvs-commits mailing list