BUG-7464: fix checkstyle warnings
[yangtools.git] / third-party / triemap / src / main / java / org / opendaylight / yangtools / triemap / LNodeEntries.java
index 2fbfc7299575c3bd7646737431a4c83abc585734..570205e7a9f1b7d756834ce126c783d04095742c 100644 (file)
  */
 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'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
  *
@@ -26,8 +28,8 @@ package org.opendaylight.yangtools.triemap;
  */
 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
@@ -41,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;
         }
 
@@ -56,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) {
@@ -90,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) {
@@ -122,6 +124,6 @@ abstract class LNodeEntries<K, V> extends LNodeEntry<K, V> {
             cur = cur.next();
         }
 
-        throw new IllegalStateException(String.format("Entry %s not found", entry));
+        throw new VerifyException(String.format("Failed to find entry %s", entry));
     }
 }