commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1429905 [14/26] - in /commons/proper/collections/trunk/src: main/java/org/apache/commons/collections/ main/java/org/apache/commons/collections/bag/ main/java/org/apache/commons/collections/bidimap/ main/java/org/apache/commons/collections/...
Date Mon, 07 Jan 2013 17:15:24 GMT
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/PatriciaTrie.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/PatriciaTrie.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/PatriciaTrie.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/PatriciaTrie.java Mon Jan  7 17:15:14 2013
@@ -73,12 +73,12 @@ public class PatriciaTrie<K, V> extends 
     
     private static final long serialVersionUID = 4446367780901817838L;
 
-    public PatriciaTrie(KeyAnalyzer<? super K> keyAnalyzer) {
+    public PatriciaTrie(final KeyAnalyzer<? super K> keyAnalyzer) {
         super(keyAnalyzer);
     }
 
-    public PatriciaTrie(KeyAnalyzer<? super K> keyAnalyzer,
-            Map<? extends K, ? extends V> m) {
+    public PatriciaTrie(final KeyAnalyzer<? super K> keyAnalyzer,
+            final Map<? extends K, ? extends V> m) {
         super(keyAnalyzer, m);
     }
     
@@ -92,29 +92,29 @@ public class PatriciaTrie<K, V> extends 
     /**
      * {@inheritDoc}
      */
-    public SortedMap<K, V> getPrefixedBy(K key) {
+    public SortedMap<K, V> getPrefixedBy(final K key) {
         return getPrefixedByBits(key, 0, lengthInBits(key));
     }
 
     /**
      * {@inheritDoc}
      */
-    public SortedMap<K, V> getPrefixedBy(K key, int length) {
+    public SortedMap<K, V> getPrefixedBy(final K key, final int length) {
         return getPrefixedByBits(key, 0, length * bitsPerElement());
     }
 
     /**
      * {@inheritDoc}
      */
-    public SortedMap<K, V> getPrefixedBy(K key, int offset, int length) {
-        int bitsPerElement = bitsPerElement();
+    public SortedMap<K, V> getPrefixedBy(final K key, final int offset, final int length) {
+        final int bitsPerElement = bitsPerElement();
         return getPrefixedByBits(key, offset*bitsPerElement, length*bitsPerElement);
     }
 
     /**
      * {@inheritDoc}
      */
-    public SortedMap<K, V> getPrefixedByBits(K key, int lengthInBits) {
+    public SortedMap<K, V> getPrefixedByBits(final K key, final int lengthInBits) {
         return getPrefixedByBits(key, 0, lengthInBits);
     }
     
@@ -129,7 +129,7 @@ public class PatriciaTrie<K, V> extends 
      * {@inheritDoc}
      */
     public K lastKey() {
-        TrieEntry<K, V> entry = lastEntry();
+        final TrieEntry<K, V> entry = lastEntry();
         if (entry != null) {
             return entry.getKey();
         }
@@ -150,9 +150,9 @@ public class PatriciaTrie<K, V> extends 
      * that contains the prefixes if the entry holding the subtree is 
      * removed or changes. Changing the subtree takes O(K) time.
      */
-    public SortedMap<K, V> getPrefixedByBits(K key, int offsetInBits, int lengthInBits) {
+    public SortedMap<K, V> getPrefixedByBits(final K key, final int offsetInBits, final int lengthInBits) {
         
-        int offsetLength = offsetInBits + lengthInBits;
+        final int offsetLength = offsetInBits + lengthInBits;
         if (offsetLength > lengthInBits(key)) {
             throw new IllegalArgumentException(offsetInBits + " + " 
                     + lengthInBits + " > " + lengthInBits(key));
@@ -168,21 +168,21 @@ public class PatriciaTrie<K, V> extends 
     /**
      * {@inheritDoc}
      */
-    public SortedMap<K, V> headMap(K toKey) {
+    public SortedMap<K, V> headMap(final K toKey) {
         return new RangeEntryMap(null, toKey);
     }
 
     /**
      * {@inheritDoc}
      */
-    public SortedMap<K, V> subMap(K fromKey, K toKey) {
+    public SortedMap<K, V> subMap(final K fromKey, final K toKey) {
         return new RangeEntryMap(fromKey, toKey);
     }
 
     /**
      * {@inheritDoc}
      */
-    public SortedMap<K, V> tailMap(K fromKey) {
+    public SortedMap<K, V> tailMap(final K fromKey) {
         return new RangeEntryMap(fromKey, null);
     } 
     
@@ -190,11 +190,11 @@ public class PatriciaTrie<K, V> extends 
      * Returns an entry strictly higher than the given key,
      * or null if no such entry exists.
      */
-    TrieEntry<K,V> higherEntry(K key) {
+    TrieEntry<K,V> higherEntry(final K key) {
         // TODO: Cleanup so that we don't actually have to add/remove from the
         //       tree.  (We do it here because there are other well-defined 
         //       functions to perform the search.)
-        int lengthInBits = lengthInBits(key);
+        final int lengthInBits = lengthInBits(key);
         
         if (lengthInBits == 0) {
             if (!root.isEmpty()) {
@@ -210,17 +210,17 @@ public class PatriciaTrie<K, V> extends 
             }
         }
         
-        TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
+        final TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
         if (compareKeys(key, found.key)) {
             return nextEntry(found);
         }
         
-        int bitIndex = bitIndex(key, found.key);
+        final int bitIndex = bitIndex(key, found.key);
         if (AbstractKeyAnalyzer.isValidBitIndex(bitIndex)) {
-            TrieEntry<K, V> added = new TrieEntry<K, V>(key, null, bitIndex);
+            final TrieEntry<K, V> added = new TrieEntry<K, V>(key, null, bitIndex);
             addEntry(added, lengthInBits);
             incrementSize(); // must increment because remove will decrement
-            TrieEntry<K, V> ceil = nextEntry(added);
+            final TrieEntry<K, V> ceil = nextEntry(added);
             removeEntry(added);
             modCount -= 2; // we didn't really modify it.
             return ceil;
@@ -244,7 +244,7 @@ public class PatriciaTrie<K, V> extends 
      * Returns a key-value mapping associated with the least key greater
      * than or equal to the given key, or null if there is no such key.
      */
-    TrieEntry<K,V> ceilingEntry(K key) {
+    TrieEntry<K,V> ceilingEntry(final K key) {
         // Basically:
         // Follow the steps of adding an entry, but instead...
         //
@@ -263,7 +263,7 @@ public class PatriciaTrie<K, V> extends 
         // TODO: Cleanup so that we don't actually have to add/remove from the
         //       tree.  (We do it here because there are other well-defined 
         //       functions to perform the search.)
-        int lengthInBits = lengthInBits(key);
+        final int lengthInBits = lengthInBits(key);
         
         if (lengthInBits == 0) {
             if (!root.isEmpty()) {
@@ -273,17 +273,17 @@ public class PatriciaTrie<K, V> extends 
             }
         }
         
-        TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
+        final TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
         if (compareKeys(key, found.key)) {
             return found;
         }
         
-        int bitIndex = bitIndex(key, found.key);
+        final int bitIndex = bitIndex(key, found.key);
         if (AbstractKeyAnalyzer.isValidBitIndex(bitIndex)) {
-            TrieEntry<K, V> added = new TrieEntry<K, V>(key, null, bitIndex);
+            final TrieEntry<K, V> added = new TrieEntry<K, V>(key, null, bitIndex);
             addEntry(added, lengthInBits);
             incrementSize(); // must increment because remove will decrement
-            TrieEntry<K, V> ceil = nextEntry(added);
+            final TrieEntry<K, V> ceil = nextEntry(added);
             removeEntry(added);
             modCount -= 2; // we didn't really modify it.
             return ceil;
@@ -305,7 +305,7 @@ public class PatriciaTrie<K, V> extends 
      * Returns a key-value mapping associated with the greatest key
      * strictly less than the given key, or null if there is no such key.
      */
-    TrieEntry<K,V> lowerEntry(K key) {
+    TrieEntry<K,V> lowerEntry(final K key) {
         // Basically:
         // Follow the steps of adding an entry, but instead...
         //
@@ -323,23 +323,23 @@ public class PatriciaTrie<K, V> extends 
         // TODO: Cleanup so that we don't actually have to add/remove from the
         //       tree.  (We do it here because there are other well-defined 
         //       functions to perform the search.)
-        int lengthInBits = lengthInBits(key);
+        final int lengthInBits = lengthInBits(key);
         
         if (lengthInBits == 0) {
             return null; // there can never be anything before root.
         }
         
-        TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
+        final TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
         if (compareKeys(key, found.key)) {
             return previousEntry(found);
         }
         
-        int bitIndex = bitIndex(key, found.key);
+        final int bitIndex = bitIndex(key, found.key);
         if (AbstractKeyAnalyzer.isValidBitIndex(bitIndex)) {
-            TrieEntry<K, V> added = new TrieEntry<K, V>(key, null, bitIndex);
+            final TrieEntry<K, V> added = new TrieEntry<K, V>(key, null, bitIndex);
             addEntry(added, lengthInBits);
             incrementSize(); // must increment because remove will decrement
-            TrieEntry<K, V> prior = previousEntry(added);
+            final TrieEntry<K, V> prior = previousEntry(added);
             removeEntry(added);
             modCount -= 2; // we didn't really modify it.
             return prior;
@@ -357,11 +357,11 @@ public class PatriciaTrie<K, V> extends 
      * Returns a key-value mapping associated with the greatest key
      * less than or equal to the given key, or null if there is no such key.
      */
-    TrieEntry<K,V> floorEntry(K key) {        
+    TrieEntry<K,V> floorEntry(final K key) {        
         // TODO: Cleanup so that we don't actually have to add/remove from the
         //       tree.  (We do it here because there are other well-defined 
         //       functions to perform the search.)
-        int lengthInBits = lengthInBits(key);
+        final int lengthInBits = lengthInBits(key);
         
         if (lengthInBits == 0) {
             if (!root.isEmpty()) {
@@ -371,17 +371,17 @@ public class PatriciaTrie<K, V> extends 
             }
         }
         
-        TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
+        final TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
         if (compareKeys(key, found.key)) {
             return found;
         }
         
-        int bitIndex = bitIndex(key, found.key);
+        final int bitIndex = bitIndex(key, found.key);
         if (AbstractKeyAnalyzer.isValidBitIndex(bitIndex)) {
-            TrieEntry<K, V> added = new TrieEntry<K, V>(key, null, bitIndex);
+            final TrieEntry<K, V> added = new TrieEntry<K, V>(key, null, bitIndex);
             addEntry(added, lengthInBits);
             incrementSize(); // must increment because remove will decrement
-            TrieEntry<K, V> floor = previousEntry(added);
+            final TrieEntry<K, V> floor = previousEntry(added);
             removeEntry(added);
             modCount -= 2; // we didn't really modify it.
             return floor;
@@ -405,7 +405,7 @@ public class PatriciaTrie<K, V> extends 
      * This is very similar to getR but with the difference that
      * we stop the lookup if h.bitIndex > lengthInBits.
      */
-    TrieEntry<K, V> subtree(K prefix, int offsetInBits, int lengthInBits) {
+    TrieEntry<K, V> subtree(final K prefix, final int offsetInBits, final int lengthInBits) {
         TrieEntry<K, V> current = root.left;
         TrieEntry<K, V> path = root;
         while(true) {
@@ -424,14 +424,14 @@ public class PatriciaTrie<K, V> extends 
         }        
 
         // Make sure the entry is valid for a subtree.
-        TrieEntry<K, V> entry = current.isEmpty() ? path : current;
+        final TrieEntry<K, V> entry = current.isEmpty() ? path : current;
         
         // If entry is root, it can't be empty.
         if (entry.isEmpty()) {
             return null;
         }
         
-        int endIndexInBits = offsetInBits + lengthInBits;
+        final int endIndexInBits = offsetInBits + lengthInBits;
         
         // if root && length of root is less than length of lookup,
         // there's nothing.
@@ -449,7 +449,7 @@ public class PatriciaTrie<K, V> extends 
         }
         
         // ... or there are less than 'length' equal bits
-        int bitIndex = keyAnalyzer.bitIndex(prefix, offsetInBits, 
+        final int bitIndex = keyAnalyzer.bitIndex(prefix, offsetInBits, 
                 lengthInBits, entry.key, 0, lengthInBits(entry.getKey()));
         
         if (bitIndex >= 0 && bitIndex < lengthInBits) {
@@ -505,7 +505,7 @@ public class PatriciaTrie<K, V> extends 
      * 
      * @param start
      */
-    TrieEntry<K, V> previousEntry(TrieEntry<K, V> start) {
+    TrieEntry<K, V> previousEntry(final TrieEntry<K, V> start) {
         if (start.predecessor == null) {
             throw new IllegalArgumentException("must have come from somewhere!");
         }
@@ -550,8 +550,8 @@ public class PatriciaTrie<K, V> extends 
      * This will traverse only within the subtree.  If the given node
      * is not within the subtree, this will have undefined results.
      */
-    TrieEntry<K, V> nextEntryInSubtree(TrieEntry<K, V> node, 
-            TrieEntry<K, V> parentOfSubtree) {
+    TrieEntry<K, V> nextEntryInSubtree(final TrieEntry<K, V> node, 
+            final TrieEntry<K, V> parentOfSubtree) {
         if (node == null) {
             return firstEntry();
         } else {
@@ -607,7 +607,7 @@ public class PatriciaTrie<K, V> extends 
          * {@inheritDoc}
          */
         @Override
-        public boolean containsKey(Object key) {
+        public boolean containsKey(final Object key) {
             if (!inRange(castKey(key))) {
                 return false;
             }
@@ -619,7 +619,7 @@ public class PatriciaTrie<K, V> extends 
          * {@inheritDoc}
          */
         @Override
-        public V remove(Object key) {
+        public V remove(final Object key) {
             if (!inRange(castKey(key))) {
                 return null;
             }
@@ -631,7 +631,7 @@ public class PatriciaTrie<K, V> extends 
          * {@inheritDoc}
          */
         @Override
-        public V get(Object key) {
+        public V get(final Object key) {
             if (!inRange(castKey(key))) {
                 return null;
             }
@@ -643,7 +643,7 @@ public class PatriciaTrie<K, V> extends 
          * {@inheritDoc}
          */
         @Override
-        public V put(K key, V value) {
+        public V put(final K key, final V value) {
             if (!inRange(key)) {
                 throw new IllegalArgumentException(
                         "Key is out of range: " + key);
@@ -666,7 +666,7 @@ public class PatriciaTrie<K, V> extends 
         /**
          * {@inheritDoc}
          */
-        public SortedMap<K, V> subMap(K fromKey, K toKey) {
+        public SortedMap<K, V> subMap(final K fromKey, final K toKey) {
             if (!inRange2(fromKey)) {
                 throw new IllegalArgumentException(
                         "FromKey is out of range: " + fromKey);
@@ -684,7 +684,7 @@ public class PatriciaTrie<K, V> extends 
         /**
          * {@inheritDoc}
          */
-        public SortedMap<K, V> headMap(K toKey) {
+        public SortedMap<K, V> headMap(final K toKey) {
             if (!inRange2(toKey)) {
                 throw new IllegalArgumentException(
                         "ToKey is out of range: " + toKey);
@@ -697,7 +697,7 @@ public class PatriciaTrie<K, V> extends 
         /**
          * {@inheritDoc}
          */
-        public SortedMap<K, V> tailMap(K fromKey) {
+        public SortedMap<K, V> tailMap(final K fromKey) {
             if (!inRange2(fromKey)) {
                 throw new IllegalArgumentException(
                         "FromKey is out of range: " + fromKey);
@@ -711,10 +711,10 @@ public class PatriciaTrie<K, V> extends 
          * Returns true if the provided key is greater than TO and
          * less than FROM
          */
-        protected boolean inRange(K key) {
+        protected boolean inRange(final K key) {
 
-            K fromKey = getFromKey();
-            K toKey = getToKey();
+            final K fromKey = getFromKey();
+            final K toKey = getToKey();
 
             return (fromKey == null || inFromRange(key, false))
                     && (toKey == null || inToRange(key, false));
@@ -723,10 +723,10 @@ public class PatriciaTrie<K, V> extends 
         /**
          * This form allows the high endpoint (as well as all legit keys)
          */
-        protected boolean inRange2(K key) {
+        protected boolean inRange2(final K key) {
 
-            K fromKey = getFromKey();
-            K toKey = getToKey();
+            final K fromKey = getFromKey();
+            final K toKey = getToKey();
 
             return (fromKey == null || inFromRange(key, false))
                     && (toKey == null || inToRange(key, true));
@@ -736,12 +736,12 @@ public class PatriciaTrie<K, V> extends 
          * Returns true if the provided key is in the FROM range 
          * of the {@link RangeMap}
          */
-        protected boolean inFromRange(K key, boolean forceInclusive) {
+        protected boolean inFromRange(final K key, final boolean forceInclusive) {
 
-            K fromKey = getFromKey();
-            boolean fromInclusive = isFromInclusive();
+            final K fromKey = getFromKey();
+            final boolean fromInclusive = isFromInclusive();
 
-            int ret = keyAnalyzer.compare(key, fromKey);
+            final int ret = keyAnalyzer.compare(key, fromKey);
             if (fromInclusive || forceInclusive) {
                 return ret >= 0;
             } else {
@@ -753,12 +753,12 @@ public class PatriciaTrie<K, V> extends 
          * Returns true if the provided key is in the TO range 
          * of the {@link RangeMap}
          */
-        protected boolean inToRange(K key, boolean forceInclusive) {
+        protected boolean inToRange(final K key, final boolean forceInclusive) {
 
-            K toKey = getToKey();
-            boolean toInclusive = isToInclusive();
+            final K toKey = getToKey();
+            final boolean toInclusive = isToInclusive();
 
-            int ret = keyAnalyzer.compare(key, toKey);
+            final int ret = keyAnalyzer.compare(key, toKey);
             if (toInclusive || forceInclusive) {
                 return ret <= 0;
             } else {
@@ -802,15 +802,15 @@ public class PatriciaTrie<K, V> extends 
         * Creates a {@link RangeEntryMap} with the fromKey included and
         * the toKey excluded from the range
         */
-       protected RangeEntryMap(K fromKey, K toKey) {
+       protected RangeEntryMap(final K fromKey, final K toKey) {
            this(fromKey, true, toKey, false);
        }
        
        /**
         * Creates a {@link RangeEntryMap}
         */
-       protected RangeEntryMap(K fromKey, boolean fromInclusive, 
-               K toKey, boolean toInclusive) {
+       protected RangeEntryMap(final K fromKey, final boolean fromInclusive, 
+               final K toKey, final boolean toInclusive) {
            
            if (fromKey == null && toKey == null) {
                throw new IllegalArgumentException("must have a from or to!");
@@ -842,7 +842,7 @@ public class PatriciaTrie<K, V> extends 
                }
            }
            
-           K first = e != null ? e.getKey() : null;
+           final K first = e != null ? e.getKey() : null;
            if (e == null || toKey != null && !inToRange(first, false)) {
                throw new NoSuchElementException();
            }
@@ -864,7 +864,7 @@ public class PatriciaTrie<K, V> extends 
                }
            }
            
-           K last = e != null ? e.getKey() : null;
+           final K last = e != null ? e.getKey() : null;
            if (e == null || fromKey != null && !inFromRange(last, false)) {
                throw new NoSuchElementException();
            }
@@ -915,8 +915,8 @@ public class PatriciaTrie<K, V> extends 
         * {@inheritDoc}
         */
        @Override
-       protected SortedMap<K, V> createRangeMap(K fromKey, boolean fromInclusive,
-               K toKey, boolean toInclusive) {
+       protected SortedMap<K, V> createRangeMap(final K fromKey, final boolean fromInclusive,
+               final K toKey, final boolean toInclusive) {
            return new RangeEntryMap(fromKey, fromInclusive, toKey, toInclusive);
        }
    }
@@ -935,7 +935,7 @@ public class PatriciaTrie<K, V> extends 
         /**
          * Creates a {@link RangeEntrySet}
          */
-        public RangeEntrySet(RangeMap delegate) {
+        public RangeEntrySet(final RangeMap delegate) {
             if (delegate == null) {
                 throw new NullPointerException("delegate");
             }
@@ -948,8 +948,8 @@ public class PatriciaTrie<K, V> extends 
          */
         @Override
         public Iterator<Map.Entry<K, V>> iterator() {
-            K fromKey = delegate.getFromKey();
-            K toKey = delegate.getToKey();
+            final K fromKey = delegate.getFromKey();
+            final K toKey = delegate.getToKey();
 
             TrieEntry<K, V> first = null;
             if (fromKey == null) {
@@ -974,7 +974,7 @@ public class PatriciaTrie<K, V> extends 
             if (size == -1 || expectedModCount != PatriciaTrie.this.modCount) {
                 size = 0;
 
-                for (Iterator<?> it = iterator(); it.hasNext(); it.next()) {
+                for (final Iterator<?> it = iterator(); it.hasNext(); it.next()) {
                     ++size;
                 }
 
@@ -996,18 +996,18 @@ public class PatriciaTrie<K, V> extends 
          */
         @SuppressWarnings("unchecked")
         @Override
-        public boolean contains(Object o) {
+        public boolean contains(final Object o) {
             if (!(o instanceof Map.Entry)) {
                 return false;
             }
 
-            Map.Entry<K, V> entry = (Map.Entry<K, V>) o;
-            K key = entry.getKey();
+            final Map.Entry<K, V> entry = (Map.Entry<K, V>) o;
+            final K key = entry.getKey();
             if (!delegate.inRange(key)) {
                 return false;
             }
 
-            TrieEntry<K, V> node = getEntry(key);
+            final TrieEntry<K, V> node = getEntry(key);
             return node != null && compare(node.getValue(), entry.getValue());
         }
 
@@ -1016,18 +1016,18 @@ public class PatriciaTrie<K, V> extends 
          */
         @SuppressWarnings("unchecked")
         @Override
-        public boolean remove(Object o) {
+        public boolean remove(final Object o) {
             if (!(o instanceof Map.Entry)) {
                 return false;
             }
 
-            Map.Entry<K, V> entry = (Map.Entry<K, V>) o;
-            K key = entry.getKey();
+            final Map.Entry<K, V> entry = (Map.Entry<K, V>) o;
+            final K key = entry.getKey();
             if (!delegate.inRange(key)) {
                 return false;
             }
 
-            TrieEntry<K, V> node = getEntry(key);
+            final TrieEntry<K, V> node = getEntry(key);
             if (node != null && compare(node.getValue(), entry.getValue())) {
                 removeEntry(node);
                 return true;
@@ -1046,8 +1046,8 @@ public class PatriciaTrie<K, V> extends 
              * Creates a {@link EntryIterator}
              */
             private EntryIterator(
-                    TrieEntry<K,V> first, 
-                    TrieEntry<K,V> last) {
+                    final TrieEntry<K,V> first, 
+                    final TrieEntry<K,V> last) {
                 super(first);
                 
                 this.excludedKey = last != null ? last.getKey() : null;
@@ -1096,7 +1096,7 @@ public class PatriciaTrie<K, V> extends 
         /**
          * Creates a {@link PrefixRangeMap}
          */
-        private PrefixRangeMap(K prefix, int offsetInBits, int lengthInBits) {
+        private PrefixRangeMap(final K prefix, final int offsetInBits, final int lengthInBits) {
             this.prefix = prefix;
             this.offsetInBits = offsetInBits;
             this.lengthInBits = lengthInBits;
@@ -1112,7 +1112,7 @@ public class PatriciaTrie<K, V> extends 
             // The trie has changed since we last
             // found our toKey / fromKey
             if (size == - 1 || PatriciaTrie.this.modCount != expectedModCount) {
-                Iterator<Map.Entry<K, V>> it = entrySet().iterator();
+                final Iterator<Map.Entry<K, V>> it = entrySet().iterator();
                 size = 0;
                 
                 Map.Entry<K, V> entry = null;
@@ -1123,7 +1123,7 @@ public class PatriciaTrie<K, V> extends 
                 
                 fromKey = entry == null ? null : entry.getKey();
                 if (fromKey != null) {
-                    TrieEntry<K, V> prior = previousEntry((TrieEntry<K, V>)entry);
+                    final TrieEntry<K, V> prior = previousEntry((TrieEntry<K, V>)entry);
                     fromKey = prior == null ? null : prior.getKey();
                 }
                 
@@ -1160,7 +1160,7 @@ public class PatriciaTrie<K, V> extends 
                 e = higherEntry(fromKey);
             }
             
-            K first = e != null ? e.getKey() : null;
+            final K first = e != null ? e.getKey() : null;
             if (e == null || !keyAnalyzer.isPrefix(prefix, 
                     offsetInBits, lengthInBits, first)) {
                 throw new NoSuchElementException();
@@ -1182,7 +1182,7 @@ public class PatriciaTrie<K, V> extends 
                 e = lowerEntry(toKey);
             }
             
-            K last = e != null ? e.getKey() : null;
+            final K last = e != null ? e.getKey() : null;
             if (e == null || !keyAnalyzer.isPrefix(prefix, 
                     offsetInBits, lengthInBits, last)) {
                 throw new NoSuchElementException();
@@ -1196,7 +1196,7 @@ public class PatriciaTrie<K, V> extends 
          * of the provided key.
          */
         @Override
-        protected boolean inRange(K key) {
+        protected boolean inRange(final K key) {
             return keyAnalyzer.isPrefix(prefix, offsetInBits, lengthInBits, key);
         }
 
@@ -1204,7 +1204,7 @@ public class PatriciaTrie<K, V> extends 
          * Same as {@link #inRange(Object)}
          */
         @Override
-        protected boolean inRange2(K key) {
+        protected boolean inRange2(final K key) {
             return inRange(key);
         }
         
@@ -1213,7 +1213,7 @@ public class PatriciaTrie<K, V> extends 
          * of the {@link PrefixRangeMap}
          */
         @Override
-        protected boolean inFromRange(K key, boolean forceInclusive) {
+        protected boolean inFromRange(final K key, final boolean forceInclusive) {
             return keyAnalyzer.isPrefix(prefix, offsetInBits, lengthInBits, key);
         }
         
@@ -1222,7 +1222,7 @@ public class PatriciaTrie<K, V> extends 
          * of the {@link PrefixRangeMap}
          */
         @Override
-        protected boolean inToRange(K key, boolean forceInclusive) {
+        protected boolean inToRange(final K key, final boolean forceInclusive) {
             return keyAnalyzer.isPrefix(prefix, offsetInBits, lengthInBits, key);
         }
         
@@ -1271,8 +1271,8 @@ public class PatriciaTrie<K, V> extends 
          */
         @Override
         protected SortedMap<K, V> createRangeMap(
-                K fromKey, boolean fromInclusive,
-                K toKey, boolean toInclusive) {
+                final K fromKey, final boolean fromInclusive,
+                final K toKey, final boolean toInclusive) {
             return new RangeEntryMap(fromKey, fromInclusive, toKey, toInclusive);
         }
     }
@@ -1291,7 +1291,7 @@ public class PatriciaTrie<K, V> extends 
         /**
          * Creates a {@link PrefixRangeEntrySet}
          */
-        public PrefixRangeEntrySet(PrefixRangeMap delegate) {
+        public PrefixRangeEntrySet(final PrefixRangeMap delegate) {
             super(delegate);
             this.delegate = delegate;
         }
@@ -1315,7 +1315,7 @@ public class PatriciaTrie<K, V> extends 
             }
             
             if (prefixStart == null) {
-                Set<Map.Entry<K,V>> empty = Collections.emptySet();
+                final Set<Map.Entry<K,V>> empty = Collections.emptySet();
                 return empty.iterator();
             } else if (delegate.lengthInBits >= prefixStart.bitIndex) {
                 return new SingletonIterator(prefixStart);
@@ -1333,7 +1333,7 @@ public class PatriciaTrie<K, V> extends 
             
             private int hit = 0;
             
-            public SingletonIterator(TrieEntry<K, V> entry) {
+            public SingletonIterator(final TrieEntry<K, V> entry) {
                 this.entry = entry;
             }
             
@@ -1386,8 +1386,8 @@ public class PatriciaTrie<K, V> extends 
              * Starts iteration at the given entry & search only 
              * within the given subtree.
              */
-            EntryIterator(TrieEntry<K, V> startScan, K prefix, 
-                    int offset, int lengthInBits) {
+            EntryIterator(final TrieEntry<K, V> startScan, final K prefix, 
+                    final int offset, final int lengthInBits) {
                 subtree = startScan;
                 next = PatriciaTrie.this.followLeft(startScan);
                 this.prefix = prefix;
@@ -1399,7 +1399,7 @@ public class PatriciaTrie<K, V> extends 
              * {@inheritDoc}
              */
             public Map.Entry<K,V> next() {
-                Map.Entry<K, V> entry = nextEntry();
+                final Map.Entry<K, V> entry = nextEntry();
                 if (lastOne) {
                     next = null;
                 }
@@ -1410,7 +1410,7 @@ public class PatriciaTrie<K, V> extends 
              * {@inheritDoc}
              */
             @Override
-            protected TrieEntry<K, V> findNext(TrieEntry<K, V> prior) {
+            protected TrieEntry<K, V> findNext(final TrieEntry<K, V> prior) {
                 return PatriciaTrie.this.nextEntryInSubtree(prior, subtree);
             }
             
@@ -1422,7 +1422,7 @@ public class PatriciaTrie<K, V> extends 
                 // If the current entry we're removing is the subtree
                 // then we need to find a new subtree parent.
                 boolean needsFixing = false;
-                int bitIdx = subtree.bitIndex;
+                final int bitIdx = subtree.bitIndex;
                 if (current == subtree) {
                     needsFixing = true;
                 }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/PatriciaTrieBase.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/PatriciaTrieBase.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/PatriciaTrieBase.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/PatriciaTrieBase.java Mon Jan  7 17:15:14 2013
@@ -67,7 +67,7 @@ abstract class PatriciaTrieBase<K, V> ex
     /** 
      * {@inheritDoc}
      */
-    public PatriciaTrieBase(KeyAnalyzer<? super K> keyAnalyzer) {
+    public PatriciaTrieBase(final KeyAnalyzer<? super K> keyAnalyzer) {
         super(keyAnalyzer);
     }
     
@@ -76,8 +76,8 @@ abstract class PatriciaTrieBase<K, V> ex
      * and initializes the {@link Trie} with the values from the 
      * provided {@link Map}.
      */
-    public PatriciaTrieBase(KeyAnalyzer<? super K> keyAnalyzer, 
-            Map<? extends K, ? extends V> m) {
+    public PatriciaTrieBase(final KeyAnalyzer<? super K> keyAnalyzer, 
+            final Map<? extends K, ? extends V> m) {
         super(keyAnalyzer);
         
         if (m == null) {
@@ -142,12 +142,12 @@ abstract class PatriciaTrieBase<K, V> ex
      * {@inheritDoc}
      */
     @Override
-    public V put(K key, V value) {
+    public V put(final K key, final V value) {
         if (key == null) {
             throw new NullPointerException("Key cannot be null");
         }
         
-        int lengthInBits = lengthInBits(key);
+        final int lengthInBits = lengthInBits(key);
         
         // The only place to store a key with a length
         // of zero bits is the root node
@@ -160,7 +160,7 @@ abstract class PatriciaTrieBase<K, V> ex
             return root.setKeyValue(key, value);
         }
         
-        TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
+        final TrieEntry<K, V> found = getNearestEntryForKey(key, lengthInBits);
         if (compareKeys(key, found.key)) {
             if (found.isEmpty()) { // <- must be the root
                 incrementSize();
@@ -170,11 +170,11 @@ abstract class PatriciaTrieBase<K, V> ex
             return found.setKeyValue(key, value);
         }
         
-        int bitIndex = bitIndex(key, found.key);
+        final int bitIndex = bitIndex(key, found.key);
         if (!AbstractKeyAnalyzer.isOutOfBoundsIndex(bitIndex)) {
             if (AbstractKeyAnalyzer.isValidBitIndex(bitIndex)) { // in 99.999...9% the case
                 /* NEW KEY+VALUE TUPLE */
-                TrieEntry<K, V> t = new TrieEntry<K, V>(key, value, bitIndex);
+                final TrieEntry<K, V> t = new TrieEntry<K, V>(key, value, bitIndex);
                 addEntry(t, lengthInBits);
                 incrementSize();
                 return null;
@@ -207,7 +207,7 @@ abstract class PatriciaTrieBase<K, V> ex
     /**
      * Adds the given {@link TrieEntry} to the {@link Trie}
      */
-    TrieEntry<K, V> addEntry(TrieEntry<K, V> entry, int lengthInBits) {
+    TrieEntry<K, V> addEntry(final TrieEntry<K, V> entry, final int lengthInBits) {
         TrieEntry<K, V> current = root.left;
         TrieEntry<K, V> path = root;
         while(true) {
@@ -256,8 +256,8 @@ abstract class PatriciaTrieBase<K, V> ex
      * {@inheritDoc}
      */
     @Override
-    public V get(Object k) {
-        TrieEntry<K, V> entry = getEntry(k);
+    public V get(final Object k) {
+        final TrieEntry<K, V> entry = getEntry(k);
         return entry != null ? entry.getValue() : null;
     }
 
@@ -268,23 +268,23 @@ abstract class PatriciaTrieBase<K, V> ex
      * 
      * This may throw ClassCastException if the object is not of type K.
      */
-    TrieEntry<K,V> getEntry(Object k) {
-        K key = castKey(k);
+    TrieEntry<K,V> getEntry(final Object k) {
+        final K key = castKey(k);
         if (key == null) {
             return null;
         }
         
-        int lengthInBits = lengthInBits(key);
-        TrieEntry<K,V> entry = getNearestEntryForKey(key, lengthInBits);
+        final int lengthInBits = lengthInBits(key);
+        final TrieEntry<K,V> entry = getNearestEntryForKey(key, lengthInBits);
         return !entry.isEmpty() && compareKeys(key, entry.key) ? entry : null;
     }
     
     /**
      * {@inheritDoc}
      */
-    public Map.Entry<K, V> select(K key) {
-        int lengthInBits = lengthInBits(key);
-        Reference<Map.Entry<K, V>> reference 
+    public Map.Entry<K, V> select(final K key) {
+        final int lengthInBits = lengthInBits(key);
+        final Reference<Map.Entry<K, V>> reference 
             = new Reference<Map.Entry<K,V>>();
         if (!selectR(root.left, -1, key, lengthInBits, reference)) {
             return reference.get();
@@ -295,9 +295,9 @@ abstract class PatriciaTrieBase<K, V> ex
     /**
      * {@inheritDoc}
      */
-    public Map.Entry<K,V> select(K key, Cursor<? super K, ? super V> cursor) {
-        int lengthInBits = lengthInBits(key);
-        Reference<Map.Entry<K, V>> reference 
+    public Map.Entry<K,V> select(final K key, final Cursor<? super K, ? super V> cursor) {
+        final int lengthInBits = lengthInBits(key);
+        final Reference<Map.Entry<K, V>> reference 
             = new Reference<Map.Entry<K,V>>();
         selectR(root.left, -1, key, lengthInBits, cursor, reference);
         return reference.get();
@@ -309,7 +309,7 @@ abstract class PatriciaTrieBase<K, V> ex
      * because we're selecting only one best matching Entry from the 
      * {@link Trie}.
      */
-    private boolean selectR(TrieEntry<K, V> h, int bitIndex, 
+    private boolean selectR(final TrieEntry<K, V> h, final int bitIndex, 
             final K key, final int lengthInBits, 
             final Reference<Map.Entry<K, V>> reference) {
         
@@ -339,7 +339,7 @@ abstract class PatriciaTrieBase<K, V> ex
     /**
      * 
      */
-    private boolean selectR(TrieEntry<K,V> h, int bitIndex, 
+    private boolean selectR(final TrieEntry<K,V> h, final int bitIndex, 
             final K key, 
             final int lengthInBits,
             final Cursor<? super K, ? super V> cursor,
@@ -347,7 +347,7 @@ abstract class PatriciaTrieBase<K, V> ex
 
         if (h.bitIndex <= bitIndex) {
             if (!h.isEmpty()) {
-                Decision decision = cursor.select(h);
+                final Decision decision = cursor.select(h);
                 switch(decision) {
                     case REMOVE:
                         throw new UnsupportedOperationException("Cannot remove during select");
@@ -355,7 +355,7 @@ abstract class PatriciaTrieBase<K, V> ex
                         reference.set(h);
                         return false; // exit
                     case REMOVE_AND_EXIT:
-                        TrieEntry<K, V> entry = new TrieEntry<K, V>(
+                        final TrieEntry<K, V> entry = new TrieEntry<K, V>(
                                 h.getKey(), h.getValue(), -1);
                         reference.set(entry);
                         removeEntry(h);
@@ -385,12 +385,12 @@ abstract class PatriciaTrieBase<K, V> ex
     /**
      * {@inheritDoc}
      */
-    public Map.Entry<K, V> traverse(Cursor<? super K, ? super V> cursor) {
+    public Map.Entry<K, V> traverse(final Cursor<? super K, ? super V> cursor) {
         TrieEntry<K, V> entry = nextEntry(null);
         while (entry != null) {
-            TrieEntry<K, V> current = entry;
+            final TrieEntry<K, V> current = entry;
             
-            Decision decision = cursor.select(current);
+            final Decision decision = cursor.select(current);
             entry = nextEntry(current);
             
             switch(decision) {
@@ -400,7 +400,7 @@ abstract class PatriciaTrieBase<K, V> ex
                     removeEntry(current);
                     break; // out of switch, stay in while loop
                 case REMOVE_AND_EXIT:
-                    Map.Entry<K, V> value = new TrieEntry<K, V>(
+                    final Map.Entry<K, V> value = new TrieEntry<K, V>(
                             current.getKey(), current.getValue(), -1);
                     removeEntry(current);
                     return value;
@@ -417,14 +417,14 @@ abstract class PatriciaTrieBase<K, V> ex
      * {@inheritDoc}
      */
     @Override
-    public boolean containsKey(Object k) {
+    public boolean containsKey(final Object k) {
         if (k == null) {
             return false;
         }
         
-        K key = castKey(k);
-        int lengthInBits = lengthInBits(key);
-        TrieEntry<K, V> entry = getNearestEntryForKey(key, lengthInBits);
+        final K key = castKey(k);
+        final int lengthInBits = lengthInBits(key);
+        final TrieEntry<K, V> entry = getNearestEntryForKey(key, lengthInBits);
         return !entry.isEmpty() && compareKeys(key, entry.key);
     }
     
@@ -467,13 +467,13 @@ abstract class PatriciaTrieBase<K, V> ex
      * @throws ClassCastException if provided key is of an incompatible type 
      */
     @Override
-    public V remove(Object k) {
+    public V remove(final Object k) {
         if (k == null) {
             return null;
         }
         
-        K key = castKey(k);
-        int lengthInBits = lengthInBits(key);        
+        final K key = castKey(k);
+        final int lengthInBits = lengthInBits(key);        
         TrieEntry<K, V> current = root.left;
         TrieEntry<K, V> path = root;
         while (true) {
@@ -504,7 +504,7 @@ abstract class PatriciaTrieBase<K, V> ex
      * selectR but with the exception that it might return the
      * root Entry even if it's empty.
      */
-    TrieEntry<K, V> getNearestEntryForKey(K key, int lengthInBits) {
+    TrieEntry<K, V> getNearestEntryForKey(final K key, final int lengthInBits) {
         TrieEntry<K, V> current = root.left;
         TrieEntry<K, V> path = root;
         while(true) {
@@ -528,7 +528,7 @@ abstract class PatriciaTrieBase<K, V> ex
      * an internal (hard to remove) or external Entry (easy 
      * to remove)
      */
-    V removeEntry(TrieEntry<K, V> h) {
+    V removeEntry(final TrieEntry<K, V> h) {
         if (h != root) {
             if (h.isInternalNode()) {
                 removeInternalEntry(h);
@@ -547,15 +547,15 @@ abstract class PatriciaTrieBase<K, V> ex
      * If it's an external Entry then just remove it.
      * This is very easy and straight forward.
      */
-    private void removeExternalEntry(TrieEntry<K, V> h) {
+    private void removeExternalEntry(final TrieEntry<K, V> h) {
         if (h == root) {
             throw new IllegalArgumentException("Cannot delete root Entry!");
         } else if (!h.isExternalNode()) {
             throw new IllegalArgumentException(h + " is not an external Entry!");
         } 
         
-        TrieEntry<K, V> parent = h.parent;
-        TrieEntry<K, V> child = h.left == h ? h.right : h.left;
+        final TrieEntry<K, V> parent = h.parent;
+        final TrieEntry<K, V> child = h.left == h ? h.right : h.left;
         
         if (parent.left == h) {
             parent.left = child;
@@ -579,22 +579,22 @@ abstract class PatriciaTrieBase<K, V> ex
      * this code. The Idea is essentially that Entry p takes Entry h's
      * place in the trie which requires some re-wiring.
      */
-    private void removeInternalEntry(TrieEntry<K, V> h) {
+    private void removeInternalEntry(final TrieEntry<K, V> h) {
         if (h == root) {
             throw new IllegalArgumentException("Cannot delete root Entry!");
         } else if (!h.isInternalNode()) {
             throw new IllegalArgumentException(h + " is not an internal Entry!");
         } 
         
-        TrieEntry<K, V> p = h.predecessor;
+        final TrieEntry<K, V> p = h.predecessor;
         
         // Set P's bitIndex
         p.bitIndex = h.bitIndex;
         
         // Fix P's parent, predecessor and child Nodes
         {
-            TrieEntry<K, V> parent = p.parent;
-            TrieEntry<K, V> child = p.left == h ? p.right : p.left;
+            final TrieEntry<K, V> parent = p.parent;
+            final TrieEntry<K, V> child = p.left == h ? p.right : p.left;
             
             // if it was looping to itself previously,
             // it will now be pointed from it's parent
@@ -658,7 +658,7 @@ abstract class PatriciaTrieBase<K, V> ex
      * Returns the entry lexicographically after the given entry.
      * If the given entry is null, returns the first node.
      */
-    TrieEntry<K, V> nextEntry(TrieEntry<K, V> node) {
+    TrieEntry<K, V> nextEntry(final TrieEntry<K, V> node) {
         if (node == null) {
             return firstEntry();
         } else {
@@ -699,8 +699,8 @@ abstract class PatriciaTrieBase<K, V> ex
      *    
      * 7) Do Step 1 on the parent's right child.
      */
-    TrieEntry<K, V> nextEntryImpl(TrieEntry<K, V> start, 
-            TrieEntry<K, V> previous, TrieEntry<K, V> tree) {
+    TrieEntry<K, V> nextEntryImpl(final TrieEntry<K, V> start, 
+            final TrieEntry<K, V> previous, final TrieEntry<K, V> tree) {
         
         TrieEntry<K, V> current = start;
 
@@ -825,7 +825,7 @@ abstract class PatriciaTrieBase<K, V> ex
     /** 
      * Returns true if 'next' is a valid uplink coming from 'from'. 
      */
-    static boolean isValidUplink(TrieEntry<?, ?> next, TrieEntry<?, ?> from) { 
+    static boolean isValidUplink(final TrieEntry<?, ?> next, final TrieEntry<?, ?> from) { 
         return next != null && next.bitIndex <= from.bitIndex && !next.isEmpty();
     }
     
@@ -840,7 +840,7 @@ abstract class PatriciaTrieBase<K, V> ex
         
         private E item;
         
-        public void set(E item) {
+        public void set(final E item) {
             this.item = item;
         }
         
@@ -871,7 +871,7 @@ abstract class PatriciaTrieBase<K, V> ex
         /** The entry who uplinks to this entry. */ 
         protected TrieEntry<K,V> predecessor;
         
-        public TrieEntry(K key, V value, int bitIndex) {
+        public TrieEntry(final K key, final V value, final int bitIndex) {
             super(key, value);
             
             this.bitIndex = bitIndex;
@@ -910,7 +910,7 @@ abstract class PatriciaTrieBase<K, V> ex
          */
         @Override
         public String toString() {
-            StringBuilder buffer = new StringBuilder();
+            final StringBuilder buffer = new StringBuilder();
             
             if (bitIndex == -1) {
                 buffer.append("RootEntry(");
@@ -988,12 +988,12 @@ abstract class PatriciaTrieBase<K, V> ex
          * {@inheritDoc}
          */
         @Override
-        public boolean contains(Object o) {
+        public boolean contains(final Object o) {
             if (!(o instanceof Map.Entry)) {
                 return false;
             }
             
-            TrieEntry<K,V> candidate = getEntry(((Map.Entry<?, ?>)o).getKey());
+            final TrieEntry<K,V> candidate = getEntry(((Map.Entry<?, ?>)o).getKey());
             return candidate != null && candidate.equals(o);
         }
         
@@ -1001,8 +1001,8 @@ abstract class PatriciaTrieBase<K, V> ex
          * {@inheritDoc}
          */
         @Override
-        public boolean remove(Object o) {
-            int size = size();
+        public boolean remove(final Object o) {
+            final int size = size();
             PatriciaTrieBase.this.remove(o);
             return size != size();
         }
@@ -1059,7 +1059,7 @@ abstract class PatriciaTrieBase<K, V> ex
          * {@inheritDoc}
          */
         @Override
-        public boolean contains(Object o) {
+        public boolean contains(final Object o) {
             return containsKey(o);
         }
         
@@ -1067,8 +1067,8 @@ abstract class PatriciaTrieBase<K, V> ex
          * {@inheritDoc}
          */
         @Override
-        public boolean remove(Object o) {
-            int size = size();
+        public boolean remove(final Object o) {
+            final int size = size();
             PatriciaTrieBase.this.remove(o);
             return size != size();
         }
@@ -1117,7 +1117,7 @@ abstract class PatriciaTrieBase<K, V> ex
          * {@inheritDoc}
          */
         @Override
-        public boolean contains(Object o) {
+        public boolean contains(final Object o) {
             return containsValue(o);
         }
         
@@ -1133,9 +1133,9 @@ abstract class PatriciaTrieBase<K, V> ex
          * {@inheritDoc}
          */
         @Override
-        public boolean remove(Object o) {
-            for (Iterator<V> it = iterator(); it.hasNext(); ) {
-                V value = it.next();
+        public boolean remove(final Object o) {
+            for (final Iterator<V> it = iterator(); it.hasNext(); ) {
+                final V value = it.next();
                 if (compare(value, o)) {
                     it.remove();
                     return true;
@@ -1177,7 +1177,7 @@ abstract class PatriciaTrieBase<K, V> ex
         /**
          * Starts iteration at the given entry
          */
-        protected TrieIterator(TrieEntry<K, V> firstEntry) {
+        protected TrieIterator(final TrieEntry<K, V> firstEntry) {
             next = firstEntry;
         }
         
@@ -1189,7 +1189,7 @@ abstract class PatriciaTrieBase<K, V> ex
                 throw new ConcurrentModificationException();
             }
             
-            TrieEntry<K,V> e = next;
+            final TrieEntry<K,V> e = next;
             if (e == null) {
                 throw new NoSuchElementException();
             }
@@ -1202,7 +1202,7 @@ abstract class PatriciaTrieBase<K, V> ex
         /**
          * @see PatriciaTrie#nextEntry(TrieEntry)
          */
-        protected TrieEntry<K, V> findNext(TrieEntry<K, V> prior) {
+        protected TrieEntry<K, V> findNext(final TrieEntry<K, V> prior) {
             return PatriciaTrieBase.this.nextEntry(prior);
         }
         
@@ -1225,7 +1225,7 @@ abstract class PatriciaTrieBase<K, V> ex
                 throw new ConcurrentModificationException();
             }
             
-            TrieEntry<K, V> node = current;
+            final TrieEntry<K, V> node = current;
             current = null;
             PatriciaTrieBase.this.removeEntry(node);
             

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ShortKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ShortKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ShortKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ShortKeyAnalyzer.java Mon Jan  7 17:15:14 2013
@@ -44,7 +44,7 @@ public class ShortKeyAnalyzer implements
     /**
      * Returns a bit mask where the given bit is set
      */
-    private static int mask(int bit) {
+    private static int mask(final int bit) {
         return MSB >>> bit;
     }
 
@@ -58,37 +58,37 @@ public class ShortKeyAnalyzer implements
     /**
      * {@inheritDoc}
      */
-    public int lengthInBits(Short key) {
+    public int lengthInBits(final Short key) {
         return LENGTH;
     }
 
     /**
      * {@inheritDoc}
      */
-    public boolean isBitSet(Short key, int bitIndex, int lengthInBits) {
+    public boolean isBitSet(final Short key, final int bitIndex, final int lengthInBits) {
         return (key & mask(bitIndex)) != 0;
     }
 
     /**
      * {@inheritDoc}
      */
-    public int bitIndex(Short key, int offsetInBits, int lengthInBits, 
-            Short other, int otherOffsetInBits, int otherLengthInBits) {
+    public int bitIndex(final Short key, final int offsetInBits, final int lengthInBits, 
+            final Short other, final int otherOffsetInBits, final int otherLengthInBits) {
         
         if (offsetInBits != 0 || otherOffsetInBits != 0) {
             throw new IllegalArgumentException("offsetInBits=" + offsetInBits 
                     + ", otherOffsetInBits=" + otherOffsetInBits);
         }
         
-        int keyValue = key.shortValue();
+        final int keyValue = key.shortValue();
         if (keyValue == 0) {
             return NULL_BIT_KEY;
         }
 
-        int otherValue = other != null ? other.shortValue() : 0;
+        final int otherValue = other != null ? other.shortValue() : 0;
         
         if (keyValue != otherValue) {
-            int xorValue = keyValue ^ otherValue;
+            final int xorValue = keyValue ^ otherValue;
             for (int i = 0; i < LENGTH; i++) {
                 if ((xorValue & mask(i)) != 0) {
                     return i;
@@ -102,18 +102,18 @@ public class ShortKeyAnalyzer implements
     /**
      * {@inheritDoc}
      */
-    public int compare(Short o1, Short o2) {
+    public int compare(final Short o1, final Short o2) {
         return o1.compareTo(o2);
     }
     
     /**
      * {@inheritDoc}
      */
-    public boolean isPrefix(Short prefix, int offsetInBits, 
-            int lengthInBits, Short key) {
+    public boolean isPrefix(final Short prefix, final int offsetInBits, 
+            final int lengthInBits, final Short key) {
         
-        int value1 = prefix.shortValue() << offsetInBits;
-        int value2 = key.shortValue();
+        final int value1 = prefix.shortValue() << offsetInBits;
+        final int value2 = key.shortValue();
         
         int mask = 0;
         for (int i = 0; i < lengthInBits; i++) {

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/StringKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/StringKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/StringKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/StringKeyAnalyzer.java Mon Jan  7 17:15:14 2013
@@ -44,7 +44,7 @@ public class StringKeyAnalyzer extends A
     /**
      * Returns a bit mask where the given bit is set
      */
-    private static int mask(int bit) {
+    private static int mask(final int bit) {
         return MSB >>> bit;
     }
     
@@ -58,15 +58,15 @@ public class StringKeyAnalyzer extends A
     /**
      * {@inheritDoc}
      */
-    public int lengthInBits(String key) {
+    public int lengthInBits(final String key) {
         return key != null ? key.length() * LENGTH : 0;
     }
     
     /**
      * {@inheritDoc}
      */
-    public int bitIndex(String key, int offsetInBits, int lengthInBits,
-            String other, int otherOffsetInBits, int otherLengthInBits) {
+    public int bitIndex(final String key, final int offsetInBits, final int lengthInBits,
+            final String other, final int otherOffsetInBits, final int otherLengthInBits) {
         boolean allNull = true;
         
         if (offsetInBits % LENGTH != 0 || otherOffsetInBits % LENGTH != 0 
@@ -76,21 +76,21 @@ public class StringKeyAnalyzer extends A
         }
         
         
-        int beginIndex1 = offsetInBits / LENGTH;
-        int beginIndex2 = otherOffsetInBits / LENGTH;
+        final int beginIndex1 = offsetInBits / LENGTH;
+        final int beginIndex2 = otherOffsetInBits / LENGTH;
         
-        int endIndex1 = beginIndex1 + lengthInBits / LENGTH;
-        int endIndex2 = beginIndex2 + otherLengthInBits / LENGTH;
+        final int endIndex1 = beginIndex1 + lengthInBits / LENGTH;
+        final int endIndex2 = beginIndex2 + otherLengthInBits / LENGTH;
         
-        int length = Math.max(endIndex1, endIndex2);
+        final int length = Math.max(endIndex1, endIndex2);
         
         // Look at each character, and if they're different
         // then figure out which bit makes the difference
         // and return it.
         char k = 0, f = 0;
         for(int i = 0; i < length; i++) {
-            int index1 = beginIndex1 + i;
-            int index2 = beginIndex2 + i;
+            final int index1 = beginIndex1 + i;
+            final int index2 = beginIndex2 + i;
             
             if (index1 >= endIndex1) {
                 k = 0;
@@ -105,7 +105,7 @@ public class StringKeyAnalyzer extends A
             }
             
             if (k != f) {
-               int x = k ^ f;
+               final int x = k ^ f;
                return i * LENGTH + Integer.numberOfLeadingZeros(x) - LENGTH;
             }
             
@@ -126,13 +126,13 @@ public class StringKeyAnalyzer extends A
     /**
      * {@inheritDoc}
      */
-    public boolean isBitSet(String key, int bitIndex, int lengthInBits) {
+    public boolean isBitSet(final String key, final int bitIndex, final int lengthInBits) {
         if (key == null || bitIndex >= lengthInBits) {
             return false;
         }
         
-        int index = bitIndex / LENGTH;
-        int bit = bitIndex % LENGTH;
+        final int index = bitIndex / LENGTH;
+        final int bit = bitIndex % LENGTH;
         
         return (key.charAt(index) & mask(bit)) != 0;
     }
@@ -140,14 +140,14 @@ public class StringKeyAnalyzer extends A
     /**
      * {@inheritDoc}
      */
-    public boolean isPrefix(String prefix, int offsetInBits, 
-            int lengthInBits, String key) {
+    public boolean isPrefix(final String prefix, final int offsetInBits, 
+            final int lengthInBits, final String key) {
         if (offsetInBits % LENGTH != 0 || lengthInBits % LENGTH != 0) {
             throw new IllegalArgumentException(
                     "Cannot determine prefix outside of Character boundaries");
         }
     
-        String s1 = prefix.substring(offsetInBits / LENGTH, lengthInBits / LENGTH);
+        final String s1 = prefix.substring(offsetInBits / LENGTH, lengthInBits / LENGTH);
         return key.startsWith(s1);
     }
 }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/SynchronizedTrie.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/SynchronizedTrie.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/SynchronizedTrie.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/SynchronizedTrie.java Mon Jan  7 17:15:14 2013
@@ -49,7 +49,7 @@ public class SynchronizedTrie<K, V> impl
      * @return a new synchronized trie
      * @throws IllegalArgumentException if trie is null
      */
-    public static <K, V> SynchronizedTrie<K, V> synchronizedTrie(Trie<K, V> trie) {
+    public static <K, V> SynchronizedTrie<K, V> synchronizedTrie(final Trie<K, V> trie) {
         return new SynchronizedTrie<K, V>(trie);
     }
 
@@ -60,30 +60,30 @@ public class SynchronizedTrie<K, V> impl
      * @param trie  the trie to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    public SynchronizedTrie(Trie<K, V> trie) {
+    public SynchronizedTrie(final Trie<K, V> trie) {
         if (trie == null) {
             throw new IllegalArgumentException("Collection must not be null");
         }
         this.delegate = trie;
     }
 
-    public synchronized Entry<K, V> select(K key, Cursor<? super K, ? super V> cursor) {
+    public synchronized Entry<K, V> select(final K key, final Cursor<? super K, ? super V> cursor) {
         return delegate.select(key, cursor);
     }
 
-    public synchronized Entry<K, V> select(K key) {
+    public synchronized Entry<K, V> select(final K key) {
         return delegate.select(key);
     }
 
-    public synchronized K selectKey(K key) {
+    public synchronized K selectKey(final K key) {
         return delegate.selectKey(key);
     }
 
-    public synchronized V selectValue(K key) {
+    public synchronized V selectValue(final K key) {
         return delegate.selectValue(key);
     }
 
-    public synchronized Entry<K, V> traverse(Cursor<? super K, ? super V> cursor) {
+    public synchronized Entry<K, V> traverse(final Cursor<? super K, ? super V> cursor) {
         return delegate.traverse(cursor);
     }
     
@@ -103,15 +103,15 @@ public class SynchronizedTrie<K, V> impl
         delegate.clear();
     }
 
-    public synchronized boolean containsKey(Object key) {
+    public synchronized boolean containsKey(final Object key) {
         return delegate.containsKey(key);
     }
 
-    public synchronized boolean containsValue(Object value) {
+    public synchronized boolean containsValue(final Object value) {
         return delegate.containsValue(value);
     }
 
-    public synchronized V get(Object key) {
+    public synchronized V get(final Object key) {
         return delegate.get(key);
     }
 
@@ -119,15 +119,15 @@ public class SynchronizedTrie<K, V> impl
         return delegate.isEmpty();
     }
 
-    public synchronized V put(K key, V value) {
+    public synchronized V put(final K key, final V value) {
         return delegate.put(key, value);
     }
 
-    public synchronized void putAll(Map<? extends K, ? extends V> m) {
+    public synchronized void putAll(final Map<? extends K, ? extends V> m) {
         delegate.putAll(m);
     }
 
-    public synchronized V remove(Object key) {
+    public synchronized V remove(final Object key) {
         return delegate.remove(key);
     }
     
@@ -135,11 +135,11 @@ public class SynchronizedTrie<K, V> impl
         return delegate.lastKey();
     }
 
-    public synchronized SortedMap<K, V> subMap(K fromKey, K toKey) {
+    public synchronized SortedMap<K, V> subMap(final K fromKey, final K toKey) {
         return Collections.synchronizedSortedMap(delegate.subMap(fromKey, toKey));
     }
 
-    public synchronized SortedMap<K, V> tailMap(K fromKey) {
+    public synchronized SortedMap<K, V> tailMap(final K fromKey) {
         return Collections.synchronizedSortedMap(delegate.tailMap(fromKey));
     }
     
@@ -151,28 +151,28 @@ public class SynchronizedTrie<K, V> impl
         return delegate.firstKey();
     }
 
-    public synchronized SortedMap<K, V> headMap(K toKey) {
+    public synchronized SortedMap<K, V> headMap(final K toKey) {
         return Collections.synchronizedSortedMap(delegate.headMap(toKey));
     }
     
-    public synchronized SortedMap<K, V> getPrefixedBy(K key, int offset, int length) {
+    public synchronized SortedMap<K, V> getPrefixedBy(final K key, final int offset, final int length) {
         return Collections.synchronizedSortedMap(delegate.getPrefixedBy(key, offset, length));
     }
 
-    public synchronized SortedMap<K, V> getPrefixedBy(K key, int length) {
+    public synchronized SortedMap<K, V> getPrefixedBy(final K key, final int length) {
         return Collections.synchronizedSortedMap(delegate.getPrefixedBy(key, length));
     }
 
-    public synchronized SortedMap<K, V> getPrefixedBy(K key) {
+    public synchronized SortedMap<K, V> getPrefixedBy(final K key) {
         return Collections.synchronizedSortedMap(delegate.getPrefixedBy(key));
     }
 
-    public synchronized SortedMap<K, V> getPrefixedByBits(K key, int lengthInBits) {
+    public synchronized SortedMap<K, V> getPrefixedByBits(final K key, final int lengthInBits) {
         return Collections.synchronizedSortedMap(delegate.getPrefixedByBits(key, lengthInBits));
     }
 
-    public synchronized SortedMap<K, V> getPrefixedByBits(K key, 
-            int offsetInBits, int lengthInBits) {
+    public synchronized SortedMap<K, V> getPrefixedByBits(final K key, 
+            final int offsetInBits, final int lengthInBits) {
         return Collections.synchronizedSortedMap(delegate.getPrefixedByBits(key, offsetInBits, lengthInBits));
     }
 
@@ -186,7 +186,7 @@ public class SynchronizedTrie<K, V> impl
     }
     
     @Override
-    public synchronized boolean equals(Object obj) {
+    public synchronized boolean equals(final Object obj) {
         return delegate.equals(obj);
     }
     

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/UnmodifiableTrie.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/UnmodifiableTrie.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/UnmodifiableTrie.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/UnmodifiableTrie.java Mon Jan  7 17:15:14 2013
@@ -32,7 +32,7 @@ public class UnmodifiableTrie<K, V> impl
      * @return a new unmodifiable trie
      * @throws IllegalArgumentException if trie is null
      */
-    public static <K, V> UnmodifiableTrie<K, V> unmodifiableTrie(Trie<K, V> trie) {
+    public static <K, V> UnmodifiableTrie<K, V> unmodifiableTrie(final Trie<K, V> trie) {
         return new UnmodifiableTrie<K, V>(trie);
     }
 
@@ -43,17 +43,17 @@ public class UnmodifiableTrie<K, V> impl
      * @param trie  the trie to decorate, must not be null
      * @throws IllegalArgumentException if trie is null
      */
-    public UnmodifiableTrie(Trie<K, V> trie) {
+    public UnmodifiableTrie(final Trie<K, V> trie) {
         if (trie == null) {
             throw new IllegalArgumentException("Trie must not be null");
         }
         this.delegate = trie;
     }
     
-    public Entry<K, V> select(K key, final Cursor<? super K, ? super V> cursor) {
-        Cursor<K, V> c = new Cursor<K, V>() {
-            public Decision select(Map.Entry<? extends K, ? extends V> entry) {
-                Decision decision = cursor.select(entry);
+    public Entry<K, V> select(final K key, final Cursor<? super K, ? super V> cursor) {
+        final Cursor<K, V> c = new Cursor<K, V>() {
+            public Decision select(final Map.Entry<? extends K, ? extends V> entry) {
+                final Decision decision = cursor.select(entry);
                 switch (decision) {
                     case REMOVE:
                     case REMOVE_AND_EXIT:
@@ -70,22 +70,22 @@ public class UnmodifiableTrie<K, V> impl
         return delegate.select(key, c);
     }
 
-    public Entry<K, V> select(K key) {
+    public Entry<K, V> select(final K key) {
         return delegate.select(key);
     }
 
-    public K selectKey(K key) {
+    public K selectKey(final K key) {
         return delegate.selectKey(key);
     }
 
-    public V selectValue(K key) {
+    public V selectValue(final K key) {
         return delegate.selectValue(key);
     }
 
     public Entry<K, V> traverse(final Cursor<? super K, ? super V> cursor) {
-        Cursor<K, V> c = new Cursor<K, V>() {
-            public Decision select(Map.Entry<? extends K, ? extends V> entry) {
-                Decision decision = cursor.select(entry);
+        final Cursor<K, V> c = new Cursor<K, V>() {
+            public Decision select(final Map.Entry<? extends K, ? extends V> entry) {
+                final Decision decision = cursor.select(entry);
                 switch (decision) {
                     case REMOVE:
                     case REMOVE_AND_EXIT:
@@ -118,15 +118,15 @@ public class UnmodifiableTrie<K, V> impl
         throw new UnsupportedOperationException();
     }
 
-    public boolean containsKey(Object key) {
+    public boolean containsKey(final Object key) {
         return delegate.containsKey(key);
     }
 
-    public boolean containsValue(Object value) {
+    public boolean containsValue(final Object value) {
         return delegate.containsValue(value);
     }
 
-    public V get(Object key) {
+    public V get(final Object key) {
         return delegate.get(key);
     }
 
@@ -134,15 +134,15 @@ public class UnmodifiableTrie<K, V> impl
         return delegate.isEmpty();
     }
 
-    public V put(K key, V value) {
+    public V put(final K key, final V value) {
         throw new UnsupportedOperationException();
     }
 
-    public void putAll(Map<? extends K, ? extends V> m) {
+    public void putAll(final Map<? extends K, ? extends V> m) {
         throw new UnsupportedOperationException();
     }
 
-    public V remove(Object key) {
+    public V remove(final Object key) {
         throw new UnsupportedOperationException();
     }
 
@@ -150,7 +150,7 @@ public class UnmodifiableTrie<K, V> impl
         return delegate.firstKey();
     }
 
-    public SortedMap<K, V> headMap(K toKey) {
+    public SortedMap<K, V> headMap(final K toKey) {
         return Collections.unmodifiableSortedMap(delegate.headMap(toKey));
     }
 
@@ -158,36 +158,36 @@ public class UnmodifiableTrie<K, V> impl
         return delegate.lastKey();
     }
 
-    public SortedMap<K, V> subMap(K fromKey, K toKey) {
+    public SortedMap<K, V> subMap(final K fromKey, final K toKey) {
         return Collections.unmodifiableSortedMap(
                 delegate.subMap(fromKey, toKey));
     }
 
-    public SortedMap<K, V> tailMap(K fromKey) {
+    public SortedMap<K, V> tailMap(final K fromKey) {
         return Collections.unmodifiableSortedMap(delegate.tailMap(fromKey));
     }
     
-    public SortedMap<K, V> getPrefixedBy(K key, int offset, int length) {
+    public SortedMap<K, V> getPrefixedBy(final K key, final int offset, final int length) {
         return Collections.unmodifiableSortedMap(
                 delegate.getPrefixedBy(key, offset, length));
     }
 
-    public SortedMap<K, V> getPrefixedBy(K key, int length) {
+    public SortedMap<K, V> getPrefixedBy(final K key, final int length) {
         return Collections.unmodifiableSortedMap(
                 delegate.getPrefixedBy(key, length));
     }
 
-    public SortedMap<K, V> getPrefixedBy(K key) {
+    public SortedMap<K, V> getPrefixedBy(final K key) {
         return Collections.unmodifiableSortedMap(
                 delegate.getPrefixedBy(key));
     }
 
-    public SortedMap<K, V> getPrefixedByBits(K key, int lengthInBits) {
+    public SortedMap<K, V> getPrefixedByBits(final K key, final int lengthInBits) {
         return Collections.unmodifiableSortedMap(
                 delegate.getPrefixedByBits(key, lengthInBits));
     }
     
-    public SortedMap<K, V> getPrefixedByBits(K key, int offsetInBits, int lengthInBits) {
+    public SortedMap<K, V> getPrefixedByBits(final K key, final int offsetInBits, final int lengthInBits) {
         return Collections.unmodifiableSortedMap(delegate.getPrefixedByBits(key, offsetInBits, lengthInBits));
     }
 
@@ -205,7 +205,7 @@ public class UnmodifiableTrie<K, V> impl
     }
     
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         return delegate.equals(obj);
     }
     

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractArrayListTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractArrayListTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractArrayListTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractArrayListTest.java Mon Jan  7 17:15:14 2013
@@ -29,7 +29,7 @@ import org.apache.commons.collections.li
  */
 public abstract class AbstractArrayListTest<E> extends AbstractListTest<E> {
 
-    public AbstractArrayListTest(String testName) {
+    public AbstractArrayListTest(final String testName) {
         super(testName);
     }
 
@@ -41,21 +41,21 @@ public abstract class AbstractArrayListT
 
     //-----------------------------------------------------------------------
     public void testNewArrayList() {
-        ArrayList<E> list = makeObject();
+        final ArrayList<E> list = makeObject();
         assertTrue("New list is empty", list.isEmpty());
         assertEquals("New list has size zero", 0, list.size());
 
         try {
             list.get(1);
             fail("get(int i) should have thrown IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
+        } catch (final IndexOutOfBoundsException e) {
             // Expected result
         }
     }
 
     @SuppressWarnings("unchecked")
     public void testSearch() {
-        ArrayList<E> list = makeObject();
+        final ArrayList<E> list = makeObject();
         list.add((E) "First Item");
         list.add((E) "Last Item");
         assertEquals("First item is 'First Item'", "First Item", list.get(0));

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java Mon Jan  7 17:15:14 2013
@@ -40,7 +40,7 @@ import org.apache.commons.collections.li
  */
 public abstract class AbstractLinkedListTest<T> extends AbstractListTest<T> {
 
-    public AbstractLinkedListTest(String testName) {
+    public AbstractLinkedListTest(final String testName) {
         super(testName);
     }
 
@@ -74,7 +74,7 @@ public abstract class AbstractLinkedList
         if (!isAddSupported()) {
             return;
         }
-        T o = (T) "hello";
+        final T o = (T) "hello";
 
         resetEmpty();
         getCollection().addFirst(o);
@@ -95,7 +95,7 @@ public abstract class AbstractLinkedList
         if (!isAddSupported()) {
             return;
         }
-        T o = (T) "hello";
+        final T o = (T) "hello";
 
         resetEmpty();
         getCollection().addLast(o);
@@ -117,14 +117,14 @@ public abstract class AbstractLinkedList
             getCollection().getFirst();
             fail("getFirst() should throw a NoSuchElementException for an " +
                     "empty list.");
-        } catch (NoSuchElementException e) {
+        } catch (final NoSuchElementException e) {
             // This is correct
         }
         verify();
 
         resetFull();
-        Object first = getCollection().getFirst();
-        Object confirmedFirst = getConfirmedLinkedList().getFirst();
+        final Object first = getCollection().getFirst();
+        final Object confirmedFirst = getConfirmedLinkedList().getFirst();
         assertEquals("Result returned by getFirst() was wrong.",
                 confirmedFirst, first);
         verify();
@@ -139,14 +139,14 @@ public abstract class AbstractLinkedList
             getCollection().getLast();
             fail("getLast() should throw a NoSuchElementException for an " +
                     "empty list.");
-        } catch (NoSuchElementException e) {
+        } catch (final NoSuchElementException e) {
             // This is correct
         }
         verify();
         
         resetFull();
-        Object last = getCollection().getLast();
-        Object confirmedLast = getConfirmedLinkedList().getLast();
+        final Object last = getCollection().getLast();
+        final Object confirmedLast = getConfirmedLinkedList().getLast();
         assertEquals("Result returned by getLast() was wrong.",
                 confirmedLast, last);
         verify();
@@ -165,14 +165,14 @@ public abstract class AbstractLinkedList
             getCollection().removeFirst();
             fail("removeFirst() should throw a NoSuchElementException for " +
                     "an empty list.");
-        } catch (NoSuchElementException e) {
+        } catch (final NoSuchElementException e) {
             // This is correct
         }
         verify();
         
         resetFull();
-        Object first = getCollection().removeFirst();
-        Object confirmedFirst = getConfirmedLinkedList().removeFirst();
+        final Object first = getCollection().removeFirst();
+        final Object confirmedFirst = getConfirmedLinkedList().removeFirst();
         assertEquals("Result returned by removeFirst() was wrong.",
                 confirmedFirst, first);
         verify();
@@ -191,14 +191,14 @@ public abstract class AbstractLinkedList
             getCollection().removeLast();
             fail("removeLast() should throw a NoSuchElementException for " +
                     "an empty list.");
-        } catch (NoSuchElementException e) {
+        } catch (final NoSuchElementException e) {
             // This is correct
         }
         verify();
 
         resetFull();
-        Object last = getCollection().removeLast();
-        Object confirmedLast = getConfirmedLinkedList().removeLast();
+        final Object last = getCollection().removeLast();
+        final Object confirmedLast = getConfirmedLinkedList().removeLast();
         assertEquals("Result returned by removeLast() was wrong.",
                 confirmedLast, last);
         verify();
@@ -217,7 +217,7 @@ public abstract class AbstractLinkedList
      */
     @Override
     public Collection<T> makeConfirmedFullCollection() {
-        List<T> list = new LinkedList<T>();
+        final List<T> list = new LinkedList<T>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractObjectTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractObjectTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractObjectTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractObjectTest.java Mon Jan  7 17:15:14 2013
@@ -54,7 +54,7 @@ public abstract class AbstractObjectTest
      * 
      * @param testName  the test class name
      */
-    public AbstractObjectTest(String testName) {
+    public AbstractObjectTest(final String testName) {
         super(testName);
     }
 
@@ -106,28 +106,28 @@ public abstract class AbstractObjectTest
 
     //-----------------------------------------------------------------------
     public void testObjectEqualsSelf() {
-        Object obj = makeObject();
+        final Object obj = makeObject();
         assertEquals("A Object should equal itself", obj, obj);
     }
 
     public void testEqualsNull() {
-        Object obj = makeObject();
+        final Object obj = makeObject();
         assertEquals(false, obj.equals(null)); // make sure this doesn't throw NPE either
     }
 
     public void testObjectHashCodeEqualsSelfHashCode() {
-        Object obj = makeObject();
+        final Object obj = makeObject();
         assertEquals("hashCode should be repeatable", obj.hashCode(), obj.hashCode());
     }
 
     public void testObjectHashCodeEqualsContract() {
-        Object obj1 = makeObject();
+        final Object obj1 = makeObject();
         if (obj1.equals(obj1)) {
             assertEquals(
                 "[1] When two objects are equal, their hashCodes should be also.",
                 obj1.hashCode(), obj1.hashCode());
         }
-        Object obj2 = makeObject();
+        final Object obj2 = makeObject();
         if (obj1.equals(obj2)) {
             assertEquals(
                 "[2] When two objects are equal, their hashCodes should be also.",
@@ -138,23 +138,23 @@ public abstract class AbstractObjectTest
         }
     }
 
-    protected Object serializeDeserialize(Object obj) throws Exception {
-        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(buffer);
+    protected Object serializeDeserialize(final Object obj) throws Exception {
+        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        final ObjectOutputStream out = new ObjectOutputStream(buffer);
         out.writeObject(obj);
         out.close();
 
-        ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
-        Object dest = in.readObject();
+        final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+        final Object dest = in.readObject();
         in.close();
 
         return dest;
     }
 
     public void testSerializeDeserializeThenCompare() throws Exception {
-        Object obj = makeObject();
+        final Object obj = makeObject();
         if (obj instanceof Serializable && isTestSerialization()) {
-            Object dest = serializeDeserialize(obj);
+            final Object dest = serializeDeserialize(obj);
             if (isEqualsCheckable()) {
                 assertEquals("obj != deserialize(serialize(obj))", obj, dest);
             }
@@ -170,9 +170,9 @@ public abstract class AbstractObjectTest
      * @throws ClassNotFoundException
      */
     public void testSimpleSerialization() throws Exception {
-        Object o = makeObject();
+        final Object o = makeObject();
         if (o instanceof Serializable && isTestSerialization()) {
-            byte[] objekt = writeExternalFormToBytes((Serializable) o);
+            final byte[] objekt = writeExternalFormToBytes((Serializable) o);
             readExternalFormFromBytes(objekt);
         }
     }
@@ -183,9 +183,9 @@ public abstract class AbstractObjectTest
      */
     public void testCanonicalEmptyCollectionExists() {
         if (supportsEmptyCollections() && isTestSerialization() && !skipSerializedCanonicalTests()) {
-            Object object = makeObject();
+            final Object object = makeObject();
             if (object instanceof Serializable) {
-                String name = getCanonicalEmptyCollectionName(object);
+                final String name = getCanonicalEmptyCollectionName(object);
                 assertTrue(
                     "Canonical empty collection (" + name + ") is not in SVN",
                     new File(name).exists());
@@ -199,9 +199,9 @@ public abstract class AbstractObjectTest
      */
     public void testCanonicalFullCollectionExists() {
         if (supportsFullCollections() && isTestSerialization() && !skipSerializedCanonicalTests()) {
-            Object object = makeObject();
+            final Object object = makeObject();
             if (object instanceof Serializable) {
-                String name = getCanonicalFullCollectionName(object);
+                final String name = getCanonicalFullCollectionName(object);
                 assertTrue(
                     "Canonical full collection (" + name + ") is not in SVN",
                     new File(name).exists());
@@ -231,8 +231,8 @@ public abstract class AbstractObjectTest
         return "1";
     }
 
-    protected String getCanonicalEmptyCollectionName(Object object) {
-        StringBuilder retval = new StringBuilder();
+    protected String getCanonicalEmptyCollectionName(final Object object) {
+        final StringBuilder retval = new StringBuilder();
         retval.append(TEST_DATA_PATH);
         String colName = object.getClass().getName();
         colName = colName.substring(colName.lastIndexOf(".") + 1, colName.length());
@@ -243,8 +243,8 @@ public abstract class AbstractObjectTest
         return retval.toString();
     }
 
-    protected String getCanonicalFullCollectionName(Object object) {
-        StringBuilder retval = new StringBuilder();
+    protected String getCanonicalFullCollectionName(final Object object) {
+        final StringBuilder retval = new StringBuilder();
         retval.append(TEST_DATA_PATH);
         String colName = object.getClass().getName();
         colName = colName.substring(colName.lastIndexOf(".") + 1, colName.length());
@@ -267,8 +267,8 @@ public abstract class AbstractObjectTest
      * @param path path to write the serialized Object
      * @exception IOException
      */
-    protected void writeExternalFormToDisk(Serializable o, String path) throws IOException {
-        FileOutputStream fileStream = new FileOutputStream(path);
+    protected void writeExternalFormToDisk(final Serializable o, final String path) throws IOException {
+        final FileOutputStream fileStream = new FileOutputStream(path);
         writeExternalFormToStream(o, fileStream);
     }
 
@@ -280,8 +280,8 @@ public abstract class AbstractObjectTest
      * @return serialized form of the Object
      * @exception IOException
      */
-    protected byte[] writeExternalFormToBytes(Serializable o) throws IOException {
-        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+    protected byte[] writeExternalFormToBytes(final Serializable o) throws IOException {
+        final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
         writeExternalFormToStream(o, byteStream);
         return byteStream.toByteArray();
     }
@@ -296,8 +296,8 @@ public abstract class AbstractObjectTest
      * @exception IOException
      * @exception ClassNotFoundException
      */
-    protected Object readExternalFormFromDisk(String path) throws IOException, ClassNotFoundException {
-        FileInputStream stream = new FileInputStream(path);
+    protected Object readExternalFormFromDisk(final String path) throws IOException, ClassNotFoundException {
+        final FileInputStream stream = new FileInputStream(path);
         return readExternalFormFromStream(stream);
     }
 
@@ -310,8 +310,8 @@ public abstract class AbstractObjectTest
      * @exception IOException
      * @exception ClassNotFoundException
      */
-    protected Object readExternalFormFromBytes(byte[] b) throws IOException, ClassNotFoundException {
-        ByteArrayInputStream stream = new ByteArrayInputStream(b);
+    protected Object readExternalFormFromBytes(final byte[] b) throws IOException, ClassNotFoundException {
+        final ByteArrayInputStream stream = new ByteArrayInputStream(b);
         return readExternalFormFromStream(stream);
     }
 
@@ -321,13 +321,13 @@ public abstract class AbstractObjectTest
 
     // private implementation
     //-----------------------------------------------------------------------
-    private Object readExternalFormFromStream(InputStream stream) throws IOException, ClassNotFoundException {
-        ObjectInputStream oStream = new ObjectInputStream(stream);
+    private Object readExternalFormFromStream(final InputStream stream) throws IOException, ClassNotFoundException {
+        final ObjectInputStream oStream = new ObjectInputStream(stream);
         return oStream.readObject();
     }
 
-    private void writeExternalFormToStream(Serializable o, OutputStream stream) throws IOException {
-        ObjectOutputStream oStream = new ObjectOutputStream(stream);
+    private void writeExternalFormToStream(final Serializable o, final OutputStream stream) throws IOException {
+        final ObjectOutputStream oStream = new ObjectOutputStream(stream);
         oStream.writeObject(o);
     }
 

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractTreeMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractTreeMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractTreeMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractTreeMapTest.java Mon Jan  7 17:15:14 2013
@@ -29,7 +29,7 @@ import org.apache.commons.collections.ma
  */
 public abstract class AbstractTreeMapTest<K, V> extends AbstractMapTest<K, V> {
 
-    public AbstractTreeMapTest(String testName) {
+    public AbstractTreeMapTest(final String testName) {
         super(testName);
     }
 
@@ -45,14 +45,14 @@ public abstract class AbstractTreeMapTes
     public abstract TreeMap<K, V> makeObject();
 
     public void testNewMap() {
-        TreeMap<K, V> map = makeObject();
+        final TreeMap<K, V> map = makeObject();
         assertTrue("New map is empty", map.isEmpty());
         assertEquals("New map has size zero", 0, map.size());
     }
 
     @SuppressWarnings("unchecked")
     public void testSearch() {
-        TreeMap<K, V> map = makeObject();
+        final TreeMap<K, V> map = makeObject();
         map.put((K) "first", (V) "First Item");
         map.put((K) "second", (V) "Second Item");
         assertEquals("Top item is 'Second Item'",



Mime
View raw message