Hello,

I had a look at UnmodifiableMap.

-in the mapIterator() the return statement can be taken out; we also need to define the it outside the if block then. Also made final.
-entrySet()/keySet()/values(): the local variable can be made final

I have attached an unidiff (diff -u..) against a 3.2 release build.

hope this helps

Robert Ribnitz

--- 
./commons-collections-3.2-src-orig/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
 2006-05-14 22:39:42.000000000 +0200
+++ 
./commons-collections-3.2-src/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
      2006-07-29 12:49:08.354541720 +0200
@@ -116,27 +116,27 @@
     }
 
     public MapIterator mapIterator() {
+       final MapIterator it;
         if (map instanceof IterableMap) {
-            MapIterator it = ((IterableMap) map).mapIterator();
-            return UnmodifiableMapIterator.decorate(it);
+             it = ((IterableMap) map).mapIterator();
         } else {
-            MapIterator it = new EntrySetMapIterator(map);
-            return UnmodifiableMapIterator.decorate(it);
+            it = new EntrySetMapIterator(map);
         }
+        return UnmodifiableMapIterator.decorate(it);
     }
 
     public Set entrySet() {
-        Set set = super.entrySet();
+        final Set set = super.entrySet();
         return UnmodifiableEntrySet.decorate(set);
     }
 
     public Set keySet() {
-        Set set = super.keySet();
+        final Set set = super.keySet();
         return UnmodifiableSet.decorate(set);
     }
 
     public Collection values() {
-        Collection coll = super.values();
+        final Collection coll = super.values();
         return UnmodifiableCollection.decorate(coll);
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to