BUG-7464: fix checkstyle warnings 35/50135/7
authorRobert Varga <rovarga@cisco.com>
Mon, 9 Jan 2017 15:31:52 +0000 (16:31 +0100)
committerRobert Varga <nite@hq.sk>
Tue, 10 Jan 2017 23:44:44 +0000 (23:44 +0000)
With no functional changes, this patch cleans up most
of the warnings reported by checkstyle.

Change-Id: I24833d1038eb98a04cecd18c3055757cb1ea7cbc
Signed-off-by: Robert Varga <rovarga@cisco.com>
29 files changed:
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/AbstractKeySet.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/CNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/Constants.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/EntryNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/INode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/ImmutableKeySet.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/ImmutableTrieMap.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/LNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/LNodeEntries.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MutableEntrySet.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MutableIterator.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MutableTrieMap.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/SNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TrieMap.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestCNodeFlagCollision.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestCNodeInsertionIncorrectOrder.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestConcurrentMapPutIfAbsent.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestConcurrentMapRemove.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestConcurrentMapReplace.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestDelete.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestHashCollisions.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestHashCollisionsRemoveIterator.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestInsert.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMapIterator.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMultiThreadAddDelete.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMultiThreadInserts.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMultiThreadMapIterator.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestReadOnlyAndUpdatableIterators.java

index 8e80392fab1787c1d66ef188ece05a7a14be56b4..277156a5b5a7fc826994971e48b2e0a07c7d3376 100644 (file)
@@ -21,7 +21,7 @@ import java.util.AbstractSet;
 import java.util.Collection;
 
 /**
- * Abstract base class for key set views of a TrieMap
+ * Abstract base class for key set views of a TrieMap.
  *
  * @author Robert Varga
  *
index 593a66d3c21e995c92e13f93b75fd360a9738836..f6f95298f0b7b885b1702d4c6cbfbed85ede6e93 100644 (file)
@@ -42,9 +42,9 @@ final class CNode<K, V> extends MainNode<K, V> {
         this(gen, 0, EMPTY_ARRAY);
     }
 
-    static <K, V> MainNode<K,V> dual(final SNode<K, V> x, final K k, final V v, final int hc, final int lev,
+    static <K, V> MainNode<K,V> dual(final SNode<K, V> x, final K key, final V value, final int hc, final int lev,
             final Gen gen) {
-        return dual(x, x.hc, new SNode<>(k, v, hc), hc, lev, gen);
+        return dual(x, x.hc, new SNode<>(key, value, hc), hc, lev, gen);
     }
 
     private static <K, V> MainNode<K,V> dual(final SNode<K, V> x, final int xhc, final SNode<K, V> y, final int yhc,
@@ -133,12 +133,11 @@ final class CNode<K, V> extends MainNode<K, V> {
 
     CNode<K, V> insertedAt(final int pos, final int flag, final BasicNode nn, final Gen gen) {
         int len = array.length;
-        int bmp = bitmap;
         BasicNode[] narr = new BasicNode[len + 1];
         System.arraycopy(array, 0, narr, 0, pos);
         narr [pos] = nn;
         System.arraycopy(array, pos, narr, pos + 1, len - pos);
-        return new CNode<>(gen, bmp | flag, narr);
+        return new CNode<>(gen, bitmap | flag, narr);
     }
 
     /**
@@ -235,7 +234,7 @@ final class CNode<K, V> extends MainNode<K, V> {
     // }
 
     @Override
-    public String toString () {
+    public String toString() {
         // val elems = collectLocalElems
         // "CNode(sz: %d; %s)".format(elems.size,
         // elems.sorted.mkString(", "))
index af72936550863fa427bfdb48438fbf86099a89f4..931db162259b162bebbf7a5ed196dd16120b93ff 100644 (file)
@@ -44,15 +44,14 @@ final class Constants {
      * Number of hash bits consumed in each CNode level.
      */
     static final int LEVEL_BITS = 5;
-    static {
-        verify(LEVEL_BITS == IntMath.log2(BITMAP_BITS, RoundingMode.UNNECESSARY));
-    }
 
     /**
      * Maximum depth of a TrieMap.
      */
     static final int MAX_DEPTH = 7;
+
     static {
+        verify(LEVEL_BITS == IntMath.log2(BITMAP_BITS, RoundingMode.UNNECESSARY));
         verify(MAX_DEPTH == IntMath.divide(HASH_BITS, LEVEL_BITS, RoundingMode.CEILING));
     }
 }
index d50b7d473842c37da4290f7d296b922ed8f3756c..4f12ade4f9cec77691892a41864b15984874e2f1 100644 (file)
@@ -27,7 +27,7 @@ import java.util.Map.Entry;
  */
 interface EntryNode<K, V> extends Entry<K, V> {
     @Override
-    default public V setValue(final V value) {
+    default V setValue(final V value) {
         throw new UnsupportedOperationException();
     }
 }
index f779868dc1b531513838be4c72c1a49bbae927f5..eb0d895865c94fa164d0f93f33411ed6dfe679dd 100644 (file)
@@ -73,7 +73,7 @@ final class INode<K, V> extends BasicNode {
                     return fn.READ_PREV();
                 }
 
-                // Tail recursion: return GCAS_Complete (/* READ */ mainnode, ct);
+                // Tail recursion: return GCAS_Complete(/* READ */ mainnode, ct);
                 m = /* READ */ mainnode;
                 continue;
             }
@@ -92,7 +92,7 @@ final class INode<K, V> extends BasicNode {
                     return m;
                 }
 
-                // Tail recursion: return GCAS_Complete (m, ct);
+                // Tail recursion: return GCAS_Complete(m, ct);
                 continue;
             }
 
@@ -127,9 +127,9 @@ final class INode<K, V> extends BasicNode {
      *
      * @return true if successful, false otherwise
      */
-    boolean rec_insert(final K k, final V v, final int hc, final int lev, final INode<K, V> parent,
+    boolean rec_insert(final K key, final V value, final int hc, final int lev, final INode<K, V> parent,
             final TrieMap<K, V> ct) {
-        return rec_insert(k, v, hc, lev, parent, gen, ct);
+        return rec_insert(key, value, hc, lev, parent, gen, ct);
     }
 
     private boolean rec_insert(final K k, final V v, final int hc, final int lev, final INode<K, V> parent,
@@ -155,7 +155,7 @@ final class INode<K, V> extends BasicNode {
                             return in.rec_insert(k, v, hc, lev + LEVEL_BITS, this, startgen, ct);
                         }
                         if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
-                            // Tail recursion: return rec_insert (k, v, hc, lev, parent, startgen, ct);
+                            // Tail recursion: return rec_insert(k, v, hc, lev, parent, startgen, ct);
                             continue;
                         }
 
@@ -167,8 +167,9 @@ final class INode<K, V> extends BasicNode {
                         }
 
                         final CNode<K, V> rn = (cn.gen == gen) ? cn : cn.renewed(gen, ct);
-                        final MainNode<K, V> nn = rn.updatedAt(pos, inode(CNode.dual(sn, k, v, hc, lev + LEVEL_BITS, gen)), gen);
-                        return GCAS (cn, nn, ct);
+                        final MainNode<K, V> nn = rn.updatedAt(pos, inode(
+                            CNode.dual(sn, k, v, hc, lev + LEVEL_BITS, gen)), gen);
+                        return GCAS(cn, nn, ct);
                     } else {
                         throw CNode.invalidElement(cnAtPos);
                     }
@@ -176,7 +177,7 @@ final class INode<K, V> extends BasicNode {
 
                 final CNode<K, V> rn = (cn.gen == gen) ? cn : cn.renewed(gen, ct);
                 final MainNode<K, V> ncnode = rn.insertedAt(pos, flag, new SNode<>(k, v, hc), gen);
-                return GCAS (cn, ncnode, ct);
+                return GCAS(cn, ncnode, ct);
             } else if (m instanceof TNode) {
                 clean(parent, ct, lev - LEVEL_BITS);
                 return false;
@@ -194,6 +195,15 @@ final class INode<K, V> extends BasicNode {
         throw new VerifyException("An INode can host only a CNode, a TNode or an LNode, not " + elem);
     }
 
+    @SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
+            justification = "Returning null Optional indicates the need to restart.")
+    private Optional<V> insertDual(final TrieMap<K, V> ct, final CNode<K, V> cn, final int pos, final SNode<K, V> sn,
+            final K k, final V v, final int hc, final int lev) {
+        final CNode<K, V> rn = (cn.gen == gen) ? cn : cn.renewed(gen, ct);
+        final MainNode<K, V> nn = rn.updatedAt(pos, inode(CNode.dual(sn, k, v, hc, lev + LEVEL_BITS, gen)), gen);
+        return GCAS(cn, nn, ct) ? Optional.empty() : null;
+    }
+
     /**
      * Inserts a new key value pair, given that a specific condition is met.
      *
@@ -210,15 +220,6 @@ final class INode<K, V> extends BasicNode {
         return rec_insertif(k, v, hc, cond, lev, parent, gen, ct);
     }
 
-    @SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
-            justification = "Returning null Optional indicates the need to restart.")
-    private Optional<V> insertDual(final TrieMap<K, V> ct, final CNode<K, V> cn, final int pos, final SNode<K, V> sn,
-            final K k, final V v, final int hc, final int lev) {
-        final CNode<K, V> rn = (cn.gen == gen) ? cn : cn.renewed(gen, ct);
-        final MainNode<K, V> nn = rn.updatedAt(pos, inode(CNode.dual(sn, k, v, hc, lev + LEVEL_BITS, gen)), gen);
-        return GCAS(cn, nn, ct) ? Optional.empty() : null;
-    }
-
     @SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
             justification = "Returning null Optional indicates the need to restart.")
     private Optional<V> rec_insertif(final K k, final V v, final int hc, final Object cond, final int lev,
@@ -245,7 +246,7 @@ final class INode<K, V> extends BasicNode {
                         }
 
                         if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
-                            // Tail recursion: return rec_insertif (k, v, hc, cond, lev, parent, startgen, ct);
+                            // Tail recursion: return rec_insertif(k, v, hc, cond, lev, parent, startgen, ct);
                             continue;
                         }
 
@@ -293,7 +294,7 @@ final class INode<K, V> extends BasicNode {
                     }
                 } else if (cond == null || cond == ABSENT) {
                     final CNode<K, V> rn = (cn.gen == gen) ? cn : cn.renewed(gen, ct);
-                    final CNode<K, V> ncnode = rn.insertedAt (pos, flag, new SNode<>(k, v, hc), gen);
+                    final CNode<K, V> ncnode = rn.insertedAt(pos, flag, new SNode<>(k, v, hc), gen);
                     if (GCAS(cn, ncnode, ct)) {
                         return Optional.empty();
                     }
@@ -588,4 +589,4 @@ final class INode<K, V> extends BasicNode {
     String string(final int lev) {
         return "INode";
     }
-}
\ No newline at end of file
+}
index fa8f39f3af7b58dda03063a6f444902e7d805a36..a25649e7774b0b42de351b0822876ac0284c3cda 100644 (file)
@@ -48,6 +48,7 @@ final class ImmutableKeySet<K> extends AbstractKeySet<K> {
     public boolean remove(final Object o) {
         throw unsupported();
     }
+
     @Override
     public boolean retainAll(final Collection<?> c) {
         throw unsupported();
index e6c29b6bdede7d31f2c9f52750c9c38ac77943dd..f3f63be424b89e483d8011007ca389d23ed0c3d2 100644 (file)
@@ -24,7 +24,7 @@ import java.util.function.BiFunction;
 import java.util.function.Function;
 
 /**
- * An immutable TrieMap
+ * An immutable TrieMap.
  *
  * @author Robert Varga
  *
@@ -109,7 +109,7 @@ public final class ImmutableTrieMap<K, V> extends TrieMap<K, V> {
     }
 
     @Override
-    public final TrieMap<K, V> mutableSnapshot() {
+    public TrieMap<K, V> mutableSnapshot() {
         return new MutableTrieMap<>(equiv(), new INode<>(new Gen(), root.gcasRead(this)));
     }
 
index e7905ac4e843e7c99db20d3b05e09e910926d8a3..b4584d1591b1a800964b3742442900305b441584 100644 (file)
@@ -29,8 +29,8 @@ final class LNode<K, V> extends MainNode<K, V> {
         this(LNodeEntries.map(k1, v1, k2, v2), 2);
     }
 
-    LNode<K, V> insertChild( final K k, final V v) {
-        return new LNode<>(entries.insert(k, v), size + 1);
+    LNode<K, V> insertChild( final K key, final V value) {
+        return new LNode<>(entries.insert(key, value), size + 1);
     }
 
     MainNode<K, V> removeChild(final LNodeEntry<K, V> entry, final int hc) {
@@ -48,12 +48,12 @@ final class LNode<K, V> extends MainNode<K, V> {
         return new LNode<>(map, size - 1);
     }
 
-    MainNode<K, V> replaceChild(final LNodeEntry<K, V> entry, final V v) {
-        return new LNode<>(entries.replace(entry, v), size);
+    MainNode<K, V> replaceChild(final LNodeEntry<K, V> entry, final V value) {
+        return new LNode<>(entries.replace(entry, value), size);
     }
 
-    LNodeEntry<K, V> get(final Equivalence<? super K> equiv, final K k) {
-        return entries.findEntry(equiv, k);
+    LNodeEntry<K, V> get(final Equivalence<? super K> equiv, final K key) {
+        return entries.findEntry(equiv, key);
     }
 
     LNodeEntries<K, V> entries() {
index 66cb8186400ff5ce4a4a4d9c39d2d77a76f0c6a8..570205e7a9f1b7d756834ce126c783d04095742c 100644 (file)
@@ -18,8 +18,8 @@ package org.opendaylight.yangtools.triemap;
 import com.google.common.base.VerifyException;
 
 /**
- * Similar to Scala's ListMap, this is a single-linked list of set of map entries. Aside from the Set contract, this
- * class fulfills the requirements for an immutable map entryset.
+ * Similar to Scala&apos;s ListMap, this is a single-linked list of set of map entries. Aside from the java.util.Set
+ * contract, this class fulfills the requirements for an immutable map entryset.
  *
  * @author Robert Varga
  *
@@ -28,8 +28,8 @@ import com.google.common.base.VerifyException;
  */
 abstract class LNodeEntries<K, V> extends LNodeEntry<K, V> {
     private static final class Single<K, V> extends LNodeEntries<K, V> {
-        Single(final K k, final V v) {
-            super(k, v);
+        Single(final K key, final V value) {
+            super(key, value);
         }
 
         @Override
@@ -43,12 +43,12 @@ abstract class LNodeEntries<K, V> extends LNodeEntry<K, V> {
         LNodeEntries<K, V> next;
 
         // Used in remove() only
-        Multiple(final LNodeEntries<K, V> e) {
-            this(e.getKey(), e.getValue(), null);
+        Multiple(final LNodeEntries<K, V> entry) {
+            this(entry.getKey(), entry.getValue(), null);
         }
 
-        Multiple(final K k, final V v, final LNodeEntries<K, V> next) {
-            super(k, v);
+        Multiple(final K key, final V value, final LNodeEntries<K, V> next) {
+            super(key, value);
             this.next = next;
         }
 
@@ -58,8 +58,8 @@ abstract class LNodeEntries<K, V> extends LNodeEntry<K, V> {
         }
     }
 
-    LNodeEntries(final K k, final V v) {
-        super(k, v);
+    LNodeEntries(final K key, final V value) {
+        super(key, value);
     }
 
     static <K,V> LNodeEntries<K, V> map(final K k1, final V v1, final K k2, final V v2) {
@@ -92,10 +92,10 @@ abstract class LNodeEntries<K, V> extends LNodeEntry<K, V> {
         return new Multiple<>(key, value, this);
     }
 
-    final LNodeEntries<K, V> replace(final LNodeEntry<K, V> entry, final V v) {
+    final LNodeEntries<K, V> replace(final LNodeEntry<K, V> entry, final V value) {
         final LNodeEntries<K, V> removed;
-        return (removed = remove(entry)) == null ? new Single<>(entry.getKey(), v)
-                : new Multiple<>(entry.getKey(), v, removed);
+        return (removed = remove(entry)) == null ? new Single<>(entry.getKey(), value)
+                : new Multiple<>(entry.getKey(), value, removed);
     }
 
     final LNodeEntries<K, V> remove(final LNodeEntry<K, V> entry) {
index 9476186ae5b6472ab34248f293ddfe8ced0371f8..c9bdca25c63c476fbebaed7ed06582e020f06d7a 100644 (file)
@@ -20,8 +20,8 @@ import static com.google.common.base.Preconditions.checkArgument;
 import java.util.Iterator;
 import java.util.Map.Entry;
 
-/***
- * Support for EntrySet operations required by the Map interface
+/**
+ * Support for EntrySet operations required by the Map interface.
  *
  * @param <K> the type of keys
  * @param <V> the type of values
index fdd03bca5e2213bf91f067dd3e4340e5ccf16b24..988be4099a6529e4741d204c46ae9310fec07b7f 100644 (file)
@@ -56,6 +56,7 @@ final class MutableIterator<K, V> extends AbstractIterator<K, V> {
      * {@link #setValue(Object)} methods cannot guarantee consistency with the base map and may produce surprising
      * results when the map is concurrently modified, either directly or via another entry/iterator.
      *
+     * <p>
      * The behavior is similar to what Java 8's ConcurrentHashMap does, which is probably the most consistent handling
      * of this case without requiring expensive and revalidation.
      */
@@ -81,7 +82,7 @@ final class MutableIterator<K, V> extends AbstractIterator<K, V> {
          *
          * @implSpec
          * This implementation returns the most uptodate value we have observed via this entry. It does not reflect
-         * concurrent modifications, nor does it throw {@link IllegalStateException} if the entry is removed.
+         *     concurrent modifications, nor does it throw {@link IllegalStateException} if the entry is removed.
          */
         @Override
         public V getValue() {
@@ -93,7 +94,7 @@ final class MutableIterator<K, V> extends AbstractIterator<K, V> {
          *
          * @implSpec
          * This implementation returns the most uptodate value we have observed via this entry. It does not reflect
-         * concurrent modifications, nor does it throw {@link IllegalStateException} if the entry is removed.
+         *     concurrent modifications, nor does it throw {@link IllegalStateException} if the entry is removed.
          */
         @Override
         public V setValue(final V value) {
index ed12e7c2e4a8d0f97b383df140639e3d0679608a..26fbba0816f59a44e9dd22c5d4e81654cc13bc8f 100644 (file)
@@ -112,7 +112,7 @@ final class MutableTrieMap<K, V> extends TrieMap<K, V> {
         while (true) {
             final INode<K, V> r = RDCSS_READ_ROOT();
             final MainNode<K, V> expmain = r.gcasRead(this);
-            if (RDCSS_ROOT(r, expmain, r.copyToGen (new Gen(), this))) {
+            if (RDCSS_ROOT(r, expmain, r.copyToGen(new Gen(), this))) {
                 return new ImmutableTrieMap<>(r, equiv());
             }
 
@@ -176,28 +176,28 @@ final class MutableTrieMap<K, V> extends TrieMap<K, V> {
         return new INode<>(gen, new CNode<>(gen));
     }
 
-    private void inserthc(final K k, final int hc, final V v) {
+    private void inserthc(final K key, final int hc, final V value) {
         // TODO: this is called from serialization only, which means we should not be observing any races,
         //       hence we should not need to pass down the entire tree, just equality (I think).
-        final boolean success = RDCSS_READ_ROOT().rec_insert(k, v, hc, 0, null, this);
+        final boolean success = RDCSS_READ_ROOT().rec_insert(key, value, hc, 0, null, this);
         Verify.verify(success, "Concurrent modification during serialization of map %s", this);
     }
 
-    private Optional<V> insertifhc(final K k, final int hc, final V v, final Object cond) {
+    private Optional<V> insertifhc(final K key, final int hc, final V value, final Object cond) {
         Optional<V> res;
         do {
             // Keep looping as long as we do not get a reply
-            res = RDCSS_READ_ROOT().rec_insertif(k, v, hc, cond, 0, null, this);
+            res = RDCSS_READ_ROOT().rec_insertif(key, value, hc, cond, 0, null, this);
         } while (res == null);
 
         return res;
     }
 
-    private Optional<V> removehc(final K k, final Object cond, final int hc) {
+    private Optional<V> removehc(final K key, final Object cond, final int hc) {
         Optional<V> res;
         do {
             // Keep looping as long as we do not get a reply
-            res = RDCSS_READ_ROOT().rec_remove(k, cond, hc, 0, null, this);
+            res = RDCSS_READ_ROOT().rec_remove(key, cond, hc, 0, null, this);
         } while (res == null);
 
         return res;
@@ -208,7 +208,7 @@ final class MutableTrieMap<K, V> extends TrieMap<K, V> {
     }
 
     private boolean RDCSS_ROOT(final INode<K, V> ov, final MainNode<K, V> expectedmain, final INode<K, V> nv) {
-        final RDCSS_Descriptor<K, V> desc = new RDCSS_Descriptor<> (ov, expectedmain, nv);
+        final RDCSS_Descriptor<K, V> desc = new RDCSS_Descriptor<>(ov, expectedmain, nv);
         if (CAS_ROOT(ov, desc)) {
             RDCSS_Complete(false);
             return /* READ */desc.committed;
@@ -266,7 +266,7 @@ final class MutableTrieMap<K, V> extends TrieMap<K, V> {
 
         volatile boolean committed = false;
 
-        RDCSS_Descriptor (final INode<K, V> old, final MainNode<K, V> expectedmain, final INode<K, V> nv) {
+        RDCSS_Descriptor(final INode<K, V> old, final MainNode<K, V> expectedmain, final INode<K, V> nv) {
             this.old = old;
             this.expectedmain = expectedmain;
             this.nv = nv;
index 7b1fb773fd57c2239e3b0191fcd4b33fe2d1a6d8..ef3e36a02efc8017fd19c5798337ff3b845b8544 100644 (file)
@@ -22,9 +22,9 @@ final class SNode<K, V> extends BasicNode implements EntryNode<K, V> {
     final V v;
     final int hc;
 
-    SNode(final K k, final V v, final int hc) {
-        this.k = k;
-        this.v = v;
+    SNode(final K key, final V value, final int hc) {
+        this.k = key;
+        this.v = value;
         this.hc = hc;
     }
 
@@ -71,4 +71,4 @@ final class SNode<K, V> extends BasicNode implements EntryNode<K, V> {
     public String toString() {
         return EntryUtil.string(k, v);
     }
-}
\ No newline at end of file
+}
index 9cdfb974d0b0644a3c7e3be619347a473c6ded57..7a89e218095c35fd2bd510d4a8d267bc2796e690 100644 (file)
@@ -22,21 +22,21 @@ final class TNode<K, V> extends MainNode<K, V> implements EntryNode<K, V> {
     final V v;
     final int hc;
 
-    TNode (final K k, final V v, final int hc) {
-        this.k = k;
-        this.v = v;
+    TNode(final K key, final V value, final int hc) {
+        this.k = key;
+        this.v = value;
         this.hc = hc;
     }
 
-    TNode<K, V> copy () {
+    TNode<K, V> copy() {
         return new TNode<>(k, v, hc);
     }
 
-    TNode<K, V> copyTombed () {
+    TNode<K, V> copyTombed() {
         return new TNode<>(k, v, hc);
     }
 
-    SNode<K, V> copyUntombed () {
+    SNode<K, V> copyUntombed() {
         return new SNode<>(k, v, hc);
     }
 
@@ -81,4 +81,4 @@ final class TNode<K, V> extends MainNode<K, V> implements EntryNode<K, V> {
     public String toString() {
         return EntryUtil.string(k, v);
     }
-}
\ No newline at end of file
+}
index a7a92ee1bc1687ac1a6209dcb8284f1908f76408..b0261bf0e871679dfbb097df4c93f03f197b8edb 100644 (file)
@@ -26,7 +26,7 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
 
-/***
+/**
  * This is a port of Scala's TrieMap class from the Scala Collections library. This implementation does not support
  * null keys nor null values.
  *
@@ -58,6 +58,7 @@ public abstract class TrieMap<K, V> extends AbstractMap<K, V> implements Concurr
      * Returns a snapshot of this TrieMap. This operation is lock-free and
      * linearizable.
      *
+     * <p>
      * The snapshot is lazily updated - the first time some branch in the
      * snapshot or this TrieMap are accessed, they are rewritten. This means
      * that the work of rebuilding both the snapshot and this TrieMap is
@@ -70,6 +71,7 @@ public abstract class TrieMap<K, V> extends AbstractMap<K, V> implements Concurr
      * Returns a read-only snapshot of this TrieMap. This operation is lock-free
      * and linearizable.
      *
+     * <p>
      * The snapshot is lazily updated - the first time some branch of this
      * TrieMap are accessed, it is rewritten. The work of creating the snapshot
      * is thus distributed across subsequent updates and accesses on this
@@ -77,6 +79,7 @@ public abstract class TrieMap<K, V> extends AbstractMap<K, V> implements Concurr
      * unlike when calling the `snapshot` method, but the obtained snapshot
      * cannot be modified.
      *
+     * <p>
      * This method is used by other methods such as `size` and `iterator`.
      */
     public abstract ImmutableTrieMap<K, V> immutableSnapshot();
@@ -153,22 +156,23 @@ public abstract class TrieMap<K, V> extends AbstractMap<K, V> implements Concurr
     /**
      * Return an iterator over a TrieMap.
      *
+     * <p>
      * If this is a read-only snapshot, it would return a read-only iterator.
      *
+     * <p>
      * If it is the original TrieMap or a non-readonly snapshot, it would return
      * an iterator that would allow for updates.
      *
-     * @return
+     * @return An iterator.
      */
     abstract AbstractIterator<K, V> iterator();
 
     /* internal methods provided for subclasses */
 
     /**
-     * Return an iterator over a TrieMap.
-     * This is a read-only iterator.
+     * Return an iterator over a TrieMap. This is a read-only iterator.
      *
-     * @return
+     * @return A read-only iterator.
      */
     final ImmutableIterator<K, V> immutableIterator() {
         return new ImmutableIterator<>(immutableSnapshot());
@@ -179,8 +183,8 @@ public abstract class TrieMap<K, V> extends AbstractMap<K, V> implements Concurr
         return opt.orElse(null);
     }
 
-    final int computeHash(final K k) {
-        return equiv.hash(k);
+    final int computeHash(final K key) {
+        return equiv.hash(key);
     }
 
     final Object writeReplace() throws ObjectStreamException {
@@ -213,11 +217,11 @@ public abstract class TrieMap<K, V> extends AbstractMap<K, V> implements Concurr
     /* private implementation methods */
 
     @SuppressWarnings("unchecked")
-    private V lookuphc(final K k, final int hc) {
+    private V lookuphc(final K key, final int hc) {
         Object res;
         do {
             // Keep looping as long as RESTART is being indicated
-            res = RDCSS_READ_ROOT().rec_lookup(k, hc, 0, null, this);
+            res = RDCSS_READ_ROOT().rec_lookup(key, hc, 0, null, this);
         } while (res == RESTART);
 
         return (V) res;
index 39233deb6a39eb1fc1ca63e8ecc6c63f7f51d3dc..c99cc21b9e1d3cb9baef714ebed4b97b9796edf3 100644 (file)
@@ -23,7 +23,7 @@ import org.junit.Test;
 
 public class TestCNodeFlagCollision {
     @Test
-    public void testCNodeFlagCollision () {
+    public void testCNodeFlagCollision() {
         final Map<Integer, Object> map = TrieMap.create();
         final Integer z15169 = Integer.valueOf(15169);
         final Integer z28336 = Integer.valueOf(28336);
@@ -35,16 +35,16 @@ public class TestCNodeFlagCollision {
         assertSame(z15169, map.get(z15169));
         assertNull(map.get(z28336));
 
-        map.put (z28336, z28336);
+        map.put(z28336, z28336);
         assertSame(z15169, map.get(z15169));
         assertSame(z28336, map.get(z28336));
 
-        map.remove (z15169);
+        map.remove(z15169);
 
         assertNull(map.get(z15169));
         assertSame(z28336, map.get(z28336));
 
-        map.remove (z28336);
+        map.remove(z28336);
 
         assertNull(map.get(z15169));
         assertNull(map.get(z28336));
index 078b4cba4048ea803119d176e83c48e71418c7cb..3c0f35476829aee6c02936d5d88bcf17e746f82d 100644 (file)
@@ -23,7 +23,7 @@ import org.junit.Test;
 public class TestCNodeInsertionIncorrectOrder {
 
     @Test
-    public void testCNodeInsertionIncorrectOrder () {
+    public void testCNodeInsertionIncorrectOrder() {
         final Map<Integer, Integer> map = TrieMap.create();
         final Integer z3884 = Integer.valueOf(3884);
         final Integer z4266 = Integer.valueOf(4266);
index c8cbcb5c7b162e829388dc2ca4a00dff73c846f5..3c9ba149142f6f911da51c1a59e46e9904d4e23a 100644 (file)
@@ -24,14 +24,14 @@ import java.util.concurrent.ConcurrentMap;
 import org.junit.Test;
 
 public class TestConcurrentMapPutIfAbsent {
-    private static final int COUNT = 50*1000;
+    private static final int COUNT = 50 * 1000;
 
     @Test
-    public void testConcurrentMapPutIfAbsent () {
+    public void testConcurrentMapPutIfAbsent() {
         final ConcurrentMap<Object, Object> map = TrieMap.create();
 
         for (int i = 0; i < COUNT; i++) {
-            assertNull(map.putIfAbsent (i, i));
+            assertNull(map.putIfAbsent(i, i));
             assertEquals(Integer.valueOf(i), map.putIfAbsent(i, i));
         }
     }
index 0c7d4248f51a81e9a4af1108663189298b52198f..b4b900158065561ebbee7968a77a1071294f0786 100644 (file)
@@ -24,10 +24,10 @@ import java.util.concurrent.ConcurrentMap;
 import org.junit.Test;
 
 public class TestConcurrentMapRemove {
-    private static final int COUNT = 50*1000;
+    private static final int COUNT = 50 * 1000;
 
     @Test
-    public void testConcurrentMapRemove () {
+    public void testConcurrentMapRemove() {
         final ConcurrentMap<Integer, Object> map = TrieMap.create();
 
         for (int i = 128; i < COUNT; i++) {
index 6299ba063d705de8526dad03a5d6ea17bb56fc2f..fe09e1acf90a23da0a1e3c4fcf3c8093fa728434 100644 (file)
@@ -25,10 +25,10 @@ import java.util.concurrent.ConcurrentMap;
 import org.junit.Test;
 
 public class TestConcurrentMapReplace {
-    private static final int COUNT = 50*1000;
+    private static final int COUNT = 50 * 1000;
 
     @Test
-    public void testConcurrentMapReplace () {
+    public void testConcurrentMapReplace() {
         final ConcurrentMap<Integer, Object> map = TrieMap.create();
 
         for (int i = 0; i < COUNT; i++) {
index 29454cdae2651d02593b5b1d7b31332b7f647e43..23b70873fc99a1cb51c48542e640b8fa4ab2ba23 100644 (file)
@@ -52,7 +52,7 @@ public class TestDelete {
     }
 
     @Test
-    public void testDelete () {
+    public void testDelete() {
         final TrieMap<Integer, Integer> bt = TrieMap.create();
 
         for (int i = 0; i < 10000; i++) {
@@ -71,7 +71,7 @@ public class TestDelete {
             assertNull(lookup);
         }
 
-        bt.toString ();
+        bt.toString();
     }
 
     /**
@@ -92,12 +92,12 @@ public class TestDelete {
         }
     }
 
-    private static void checkAddInsert (final TrieMap<Integer, Integer> bt, final int k) {
+    private static void checkAddInsert(final TrieMap<Integer, Integer> bt, final int k) {
         final Integer v = Integer.valueOf(k);
-        bt.remove (v);
+        bt.remove(v);
         Integer foundV = bt.get(v);
         assertNull(foundV);
-        assertNull(bt.put (v, v));
+        assertNull(bt.put(v, v));
         foundV = bt.get(v);
         assertEquals(v, foundV);
 
index f866673105d0ec69e59a1665ab8ad53ca93918ea..6884911075024aa9068bbb7cddf3fc26ddb3f230 100644 (file)
@@ -23,7 +23,7 @@ import org.junit.Test;
 
 public class TestHashCollisions {
     @Test
-    public void testHashCollisions () {
+    public void testHashCollisions() {
         final TrieMap<Object, Object> bt = TrieMap.create();
 
         insertStrings(bt);
@@ -77,7 +77,7 @@ public class TestHashCollisions {
         removeChars(bt);
     }
 
-    private static void insertChars (final TrieMap<Object, Object> bt) {
+    private static void insertChars(final TrieMap<Object, Object> bt) {
         assertNull(bt.put('a', 'a'));
         assertNull(bt.put('b', 'b'));
         assertNull(bt.put('c', 'c'));
@@ -91,7 +91,7 @@ public class TestHashCollisions {
         assertEquals('e', bt.put('e', 'e'));
     }
 
-    private static void insertStrings (final TrieMap<Object, Object> bt) {
+    private static void insertStrings(final TrieMap<Object, Object> bt) {
         assertNull(bt.put("a", "a"));
         assertNull(bt.put("b", "b"));
         assertNull(bt.put("c", "c"));
@@ -105,7 +105,7 @@ public class TestHashCollisions {
         assertEquals("e", bt.put("e", "e"));
     }
 
-    private static void insertBytes (final TrieMap<Object, Object> bt) {
+    private static void insertBytes(final TrieMap<Object, Object> bt) {
         for (byte i = 0; i < 128 && i >= 0; i++) {
             final Byte bigB = Byte.valueOf(i);
             assertNull(bt.put(bigB, bigB));
@@ -113,7 +113,7 @@ public class TestHashCollisions {
         }
     }
 
-    private static void insertInts (final TrieMap<Object, Object> bt) {
+    private static void insertInts(final TrieMap<Object, Object> bt) {
         for (int i = 0; i < 128; i++) {
             final Integer bigI = Integer.valueOf(i);
             assertNull(bt.put(bigI, bigI));
@@ -121,7 +121,7 @@ public class TestHashCollisions {
         }
     }
 
-    private static void removeChars (final TrieMap<Object, Object> bt) {
+    private static void removeChars(final TrieMap<Object, Object> bt) {
         assertNotNull(bt.get('a'));
         assertNotNull(bt.get('b'));
         assertNotNull(bt.get('c'));
@@ -147,7 +147,7 @@ public class TestHashCollisions {
         assertNull(bt.get('e'));
     }
 
-    private static void removeStrings (final TrieMap<Object, Object> bt) {
+    private static void removeStrings(final TrieMap<Object, Object> bt) {
         assertNotNull(bt.get("a"));
         assertNotNull(bt.get("b"));
         assertNotNull(bt.get("c"));
@@ -173,7 +173,7 @@ public class TestHashCollisions {
         assertNull(bt.get("e"));
     }
 
-    private static void removeInts (final TrieMap<Object, Object> bt) {
+    private static void removeInts(final TrieMap<Object, Object> bt) {
         for (int i = 0; i < 128; i++) {
             final Integer bigI = Integer.valueOf(i);
             assertNotNull(bt.get(bigI));
@@ -183,7 +183,7 @@ public class TestHashCollisions {
         }
     }
 
-    private static void removeBytes (final TrieMap<Object, Object> bt) {
+    private static void removeBytes(final TrieMap<Object, Object> bt) {
         for (byte i = 0; i < 128 && i >= 0; i++) {
             final Byte bigB = Byte.valueOf(i);
             assertNotNull(bt.get(bigB));
index 2b5f5f21d28f0e3ccda516c92290ea9028bd7935..b564770dff87360de350070977d9d0b4e1eb058c 100644 (file)
@@ -29,7 +29,7 @@ public class TestHashCollisionsRemoveIterator {
     private static final int COUNT = 50000;
 
     @Test
-    public void testHashCollisionsRemoveIterator () {
+    public void testHashCollisionsRemoveIterator() {
         final Map<Object, Object> bt = TrieMap.create();
         for (int j = 0; j < COUNT; j++) {
             bt.put(Integer.valueOf(j), Integer.valueOf(j));
index aefaf1d6ee72b49a1edf3f7e594bc98d41aa2800..9a4bc7175a0bd8cebad8bf73c97a908c9c749900 100644 (file)
@@ -22,7 +22,7 @@ import org.junit.Test;
 
 public class TestInsert {
     @Test
-    public void testInsert () {
+    public void testInsert() {
         final TrieMap<Object, Object> bt = TrieMap.create();
         assertNull(bt.put("a", "a"));
         assertNull(bt.put("b", "b"));
@@ -31,7 +31,7 @@ public class TestInsert {
         assertNull(bt.put("e", "b"));
 
         for (int i = 0; i < 10000; i++) {
-            assertNull(bt.put(Integer.valueOf (i), Integer.valueOf(i)));
+            assertNull(bt.put(Integer.valueOf(i), Integer.valueOf(i)));
             final Object lookup = bt.get(Integer.valueOf(i));
             assertEquals(Integer.valueOf(i), lookup);
         }
index 764de0ae170ff0268b49ddf66407e71477f509ce..a0252d59144cf3ad5503fd36fdbfcf97773958d1 100644 (file)
@@ -35,7 +35,7 @@ public class TestMapIterator {
     public void testMapIterator() {
         final Random random = new Random();
 
-        for (int i = 0; i < 60 * 1000; i+= 400 + random.nextInt(400)) {
+        for (int i = 0; i < 60 * 1000; i += 400 + random.nextInt(400)) {
             final Map<Integer, Integer> bt = TrieMap.create();
             for (int j = 0; j < i; j++) {
                 assertNull(bt.put(Integer.valueOf(j), Integer.valueOf(j)));
@@ -59,21 +59,21 @@ public class TestMapIterator {
             for (Entry<Integer, Integer> e : bt.entrySet()) {
                 assertSame(e.getValue(), bt.get(e.getKey()));
                 e.setValue(e.getValue() + 1);
-                assertEquals((Object)e.getValue(), e.getKey () + 1);
+                assertEquals((Object)e.getValue(), e.getKey() + 1);
                 assertEquals(e.getValue(), bt.get(e.getKey()));
                 e.setValue(e.getValue() - 1);
             }
 
             final Iterator<Integer> it = bt.keySet().iterator();
-            while(it.hasNext()) {
-                final Integer k = it.next ();
+            while (it.hasNext()) {
+                final Integer k = it.next();
                 assertTrue(bt.containsKey(k));
                 it.remove();
                 assertFalse(bt.containsKey(k));
             }
 
-            assertEquals(0, bt.size ());
-            assertTrue(bt.isEmpty ());
+            assertEquals(0, bt.size());
+            assertTrue(bt.isEmpty());
         }
     }
 
@@ -81,7 +81,7 @@ public class TestMapIterator {
     public void testMapImmutableIterator() {
         final Random random = new Random();
 
-        for (int i = 0; i < 60 * 1000; i+= 400 + random.nextInt(400)) {
+        for (int i = 0; i < 60 * 1000; i += 400 + random.nextInt(400)) {
             final Map<Integer, Integer> bt = TrieMap.create();
             for (int j = 0; j < i; j++) {
                 assertNull(bt.put(Integer.valueOf(j), Integer.valueOf(j)));
index 71034c7a0c77e6dd8ac9450e13129347dd906ec1..b575e915dcb9b1281988e423829dfa39bdb81743 100644 (file)
@@ -31,7 +31,7 @@ public class TestMultiThreadAddDelete {
     private static final int COUNT = 50 * 1000;
 
     @Test
-    public void testMultiThreadAddDelete () throws InterruptedException {
+    public void testMultiThreadAddDelete() throws InterruptedException {
         for (int j = 0; j < RETRIES; j++) {
             final Map<Object, Object> bt = TrieMap.create();
 
@@ -47,7 +47,7 @@ public class TestMultiThreadAddDelete {
                         }
                     });
                 }
-                es.shutdown ();
+                es.shutdown();
                 es.awaitTermination(5, TimeUnit.MINUTES);
             }
 
@@ -58,49 +58,45 @@ public class TestMultiThreadAddDelete {
                 final ExecutorService es = Executors.newFixedThreadPool(N_THREADS);
                 for (int i = 0; i < N_THREADS; i++) {
                     final int threadNo = i;
-                    es.execute (() -> {
+                    es.execute(() -> {
                         for (int k = 0; k < COUNT; k++) {
                             if (k % N_THREADS == threadNo) {
-                                bt.remove (Integer.valueOf (k));
+                                bt.remove(Integer.valueOf(k));
                             }
                         }
                     });
                 }
-                es.shutdown ();
+                es.shutdown();
                 es.awaitTermination(5, TimeUnit.MINUTES);
             }
 
 
-            assertEquals(0, bt.size ());
+            assertEquals(0, bt.size());
             assertTrue(bt.isEmpty());
 
             {
-                final ExecutorService es = Executors.newFixedThreadPool (N_THREADS);
+                final ExecutorService es = Executors.newFixedThreadPool(N_THREADS);
                 for (int i = 0; i < N_THREADS; i++) {
                     final int threadNo = i;
-                    es.execute (new Runnable () {
+                    es.execute(new Runnable() {
                         @Override
-                        public void run () {
+                        public void run() {
                             for (int j = 0; j < COUNT; j++) {
                                 if (j % N_THREADS == threadNo) {
-                                    try {
-                                        bt.put (Integer.valueOf (j), Integer.valueOf (j));
-                                        if (!bt.containsKey (Integer.valueOf (j))) {
-                                            System.out.println (j);
-                                        }
-                                        bt.remove (Integer.valueOf (j));
-                                        if (bt.containsKey (Integer.valueOf (j))) {
-                                            System.out.println (-j);
-                                        }
-                                    } catch (Throwable t) {
-                                        t.printStackTrace ();
+                                    bt.put(Integer.valueOf(j), Integer.valueOf(j));
+                                    if (!bt.containsKey(Integer.valueOf(j))) {
+                                        System.out.println(j);
+                                    }
+                                    bt.remove(Integer.valueOf(j));
+                                    if (bt.containsKey(Integer.valueOf(j))) {
+                                        System.out.println(-j);
                                     }
                                 }
                             }
                         }
                     });
                 }
-                es.shutdown ();
+                es.shutdown();
                 es.awaitTermination(5, TimeUnit.MINUTES);
             }
 
index 019240f69dacecea21f635f054b97e9a42a62c57..d113c6a0f97860ea7f59a0ee24df7fb8c4986c69 100644 (file)
@@ -24,22 +24,22 @@ import org.junit.Test;
 
 public class TestMultiThreadInserts {
     @Test
-    public void testMultiThreadInserts () throws InterruptedException{
+    public void testMultiThreadInserts() throws InterruptedException {
         final int nThreads = 2;
         final ExecutorService es = Executors.newFixedThreadPool(nThreads);
         final TrieMap<Object, Object> bt = TrieMap.create();
         for (int i = 0; i < nThreads; i++) {
             final int threadNo = i;
-            es.execute (() -> {
+            es.execute(() -> {
                 for (int j = 0; j < 500 * 1000; j++) {
                     if (j % nThreads == threadNo) {
-                        bt.put (Integer.valueOf(j), Integer.valueOf(j));
+                        bt.put(Integer.valueOf(j), Integer.valueOf(j));
                     }
                 }
             });
         }
 
-        es.shutdown ();
+        es.shutdown();
         es.awaitTermination(5, TimeUnit.MINUTES);
 
         for (int j = 0; j < 500 * 1000; j++) {
index e7f91fed545a7af9cb7ddcc6e370c1de68fda84c..1962882f86f0ac13f7f2b0a2accaf72ce02434af 100644 (file)
@@ -33,15 +33,15 @@ public class TestMultiThreadMapIterator {
     private static final int NTHREADS = 7;
 
     @Test
-    public void testMultiThreadMapIterator () throws InterruptedException {
+    public void testMultiThreadMapIterator() throws InterruptedException {
         final Map<Object, Object> bt = TrieMap.create();
         for (int j = 0; j < 50 * 1000; j++) {
             for (final Object o : getObjects(j)) {
-                bt.put (o, o);
+                bt.put(o, o);
             }
         }
 
-        // System.out.println ("Size of initialized map is " + bt.size ());
+        // System.out.println("Size of initialized map is " + bt.size());
         int count = 0;
         {
             final ExecutorService es = Executors.newFixedThreadPool(NTHREADS);
@@ -73,19 +73,19 @@ public class TestMultiThreadMapIterator {
             final ExecutorService es = Executors.newFixedThreadPool(NTHREADS);
             for (int i = 0; i < NTHREADS; i++) {
                 final int threadNo = i;
-                es.execute (() -> {
-                    for (final Iterator<Map.Entry<Object, Object>> it = bt.entrySet ().iterator(); it.hasNext();) {
+                es.execute(() -> {
+                    for (final Iterator<Map.Entry<Object, Object>> it = bt.entrySet().iterator(); it.hasNext();) {
                         final Entry<Object, Object> e = it.next();
-                        Object key = e.getKey ();
-                        if (accepts (threadNo, NTHREADS, key)) {
-                            if (null == bt.get (key)) {
-                                // System.out.println (key);
+                        Object key = e.getKey();
+                        if (accepts(threadNo, NTHREADS, key)) {
+                            if (null == bt.get(key)) {
+                                // System.out.println(key);
                             }
                             it.remove();
-                            if (null != bt.get (key)) {
-                                // System.out.println (key);
+                            if (null != bt.get(key)) {
+                                // System.out.println(key);
                             }
-                            removed.put (key, key);
+                            removed.put(key, key);
                         }
                     }
                 });
@@ -95,27 +95,27 @@ public class TestMultiThreadMapIterator {
             es.awaitTermination(5, TimeUnit.MINUTES);
         }
 
-      count = 0;
-      for (final Object value : bt.keySet ()) {
-          value.toString ();
-          count++;
-      }
-      for (final Object o : bt.keySet ()) {
-          if (!removed.contains (bt.get (o))) {
-              System.out.println ("Not removed: " + o);
-          }
-      }
-      assertEquals(0, count);
-      assertEquals(0, bt.size ());
-      assertTrue(bt.isEmpty ());
+        count = 0;
+        for (final Object value : bt.keySet()) {
+            value.toString();
+            count++;
+        }
+        for (final Object o : bt.keySet()) {
+            if (!removed.contains(bt.get(o))) {
+                System.out.println("Not removed: " + o);
+            }
+        }
+        assertEquals(0, count);
+        assertEquals(0, bt.size());
+        assertTrue(bt.isEmpty());
     }
 
-    protected static boolean accepts (final int threadNo, final int nThreads, final Object key) {
+    protected static boolean accepts(final int threadNo, final int nrThreads, final Object key) {
         final int val = getKeyValue(key);
-        return val >= 0 ? val % nThreads == threadNo : false;
+        return val >= 0 ? val % nrThreads == threadNo : false;
     }
 
-    private static int getKeyValue (final Object key) {
+    private static int getKeyValue(final Object key) {
         if (key instanceof Integer) {
             return ((Integer) key).intValue();
         } else if (key instanceof Character) {
index fd31f798d4a8fd0f47c0deac4ab6f450d2f88cd1..4ac015a829ddb4be8282da353b9c4eb8dbee9f86 100644 (file)
@@ -23,11 +23,9 @@ import java.util.Map.Entry;
 import org.junit.Before;
 import org.junit.Test;
 
-/***
- *
+/**
  * Test that read-only iterators do not allow for any updates.
  * Test that non read-only iterators allow for updates.
- *
  */
 public class TestReadOnlyAndUpdatableIterators {
     private static final int MAP_SIZE = 200;
@@ -82,9 +80,9 @@ public class TestReadOnlyAndUpdatableIterators {
     }
 
     @Test
-    public void testIterator () {
+    public void testIterator() {
         Iterator<Entry<Integer, Integer>> it = bt.iterator();
-        it.next().setValue (0);
+        it.next().setValue(0);
         it.remove();
 
         // All changes are done on the original map
@@ -92,7 +90,7 @@ public class TestReadOnlyAndUpdatableIterators {
     }
 
     @Test
-    public void testSnapshotIterator () {
+    public void testSnapshotIterator() {
         TrieMap<Integer, Integer> snapshot = bt.mutableSnapshot();
         Iterator<Entry<Integer, Integer>> it = snapshot.iterator();
         it.next().setValue(0);
@@ -100,8 +98,8 @@ public class TestReadOnlyAndUpdatableIterators {
 
         // All changes are done on the snapshot, not on the original map
         // Map size should remain unchanged
-        assertEquals(MAP_SIZE, bt.size ());
+        assertEquals(MAP_SIZE, bt.size());
         // snapshot size was changed
-        assertEquals(MAP_SIZE-1, snapshot.size ());
+        assertEquals(MAP_SIZE - 1, snapshot.size());
     }
 }