harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r542502 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
Date Tue, 29 May 2007 12:51:42 GMT
Author: tellison
Date: Tue May 29 05:51:40 2007
New Revision: 542502

URL: http://svn.apache.org/viewvc?view=rev&rev=542502
Log:
Remove unnecessary synchronization in Hashtable.java

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java?view=diff&rev=542502&r1=542501&r2=542502
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java Tue
May 29 05:51:40 2007
@@ -441,9 +441,7 @@
                 new AbstractSet<Map.Entry<K, V>>() {
                     @Override
                     public int size() {
-                        synchronized (Hashtable.this) {
-                            return elementCount;
-                        }
+                        return elementCount;
                     }
 
                     @Override
@@ -454,25 +452,20 @@
                     @Override
                     @SuppressWarnings("unchecked")
                     public boolean remove(Object object) {
-                        synchronized (Hashtable.this) {
-                            if (contains(object)) {
-                                Hashtable.this
-                                        .remove(((Map.Entry<K, V>) object)
-                                                .getKey());
-                                return true;
-                            }
-                            return false;
+                        if (contains(object)) {
+                            Hashtable.this.remove(((Map.Entry<K, V>) object)
+                                    .getKey());
+                            return true;
                         }
+                        return false;
                     }
 
                     @Override
                     @SuppressWarnings("unchecked")
                     public boolean contains(Object object) {
-                        synchronized (Hashtable.this) {
-                            Entry<K, V> entry = getEntry(((Map.Entry<K, V>) object)
-                                    .getKey());
-                            return object.equals(entry);
-                        }
+                        Entry<K, V> entry = getEntry(((Map.Entry<K, V>) object)
+                                .getKey());
+                        return object.equals(entry);
                     }
 
                     @Override
@@ -626,16 +619,12 @@
         return new Collections.SynchronizedSet<K>(new AbstractSet<K>() {
             @Override
             public boolean contains(Object object) {
-                synchronized (Hashtable.this) {
-                    return containsKey(object);
-                }
+                return containsKey(object);
             }
 
             @Override
             public int size() {
-                synchronized (Hashtable.this) {
-                    return elementCount;
-                }
+                return elementCount;
             }
 
             @Override
@@ -645,13 +634,11 @@
 
             @Override
             public boolean remove(Object key) {
-                synchronized (Hashtable.this) {
-                    if (containsKey(key)) {
-                        Hashtable.this.remove(key);
-                        return true;
-                    }
-                    return false;
+                if (containsKey(key)) {
+                    Hashtable.this.remove(key);
+                    return true;
                 }
+                return false;
             }
 
             @Override
@@ -863,16 +850,12 @@
                 new AbstractCollection<V>() {
                     @Override
                     public boolean contains(Object object) {
-                        synchronized (Hashtable.this) {
-                            return Hashtable.this.contains(object);
-                        }
+                        return Hashtable.this.contains(object);
                     }
 
                     @Override
                     public int size() {
-                        synchronized (Hashtable.this) {
-                            return elementCount;
-                        }
+                        return elementCount;
                     }
 
                     @Override



Mime
View raw message