Address trivial eclipse warnings
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / StackedPathArguments.java
index 93dde99d1ed97999de70feb6cb332677cb54cfd7..7279b58f4b0c4253698791eba1e9880ceefa1ca2 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -7,18 +8,21 @@
 package org.opendaylight.yangtools.yang.data.api;
 
 import com.google.common.base.Preconditions;
+import com.google.common.base.Verify;
 import com.google.common.collect.UnmodifiableIterator;
 import java.util.Iterator;
 import java.util.List;
+import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 final class StackedPathArguments extends PathArgumentList {
     private final List<PathArgument> base;
     private final List<PathArgument> stack;
 
-    public StackedPathArguments(final YangInstanceIdentifier base, final List<PathArgument> stack) {
+    public StackedPathArguments(@Nonnull final YangInstanceIdentifier base, @Nonnull final List<PathArgument> stack) {
+        Verify.verify(!stack.isEmpty());
         this.base = base.getPathArguments();
-        this.stack = Preconditions.checkNotNull(stack);
+        this.stack = stack;
     }
 
     @Override
@@ -33,16 +37,15 @@ final class StackedPathArguments extends PathArgumentList {
     }
 
     @Override
-    public final PathArgument get(final int index) {
+    public PathArgument get(final int index) {
         if (index < base.size()) {
             return base.get(index);
-        } else {
-            return stack.get(index - base.size());
         }
+        return stack.get(index - base.size());
     }
 
     @Override
-    public final int indexOf(final Object o) {
+    public int indexOf(final Object o) {
         final PathArgument srch = (PathArgument) Preconditions.checkNotNull(o);
 
         int ret = base.indexOf(srch);
@@ -56,7 +59,7 @@ final class StackedPathArguments extends PathArgumentList {
     }
 
     @Override
-    public final int lastIndexOf(final Object o) {
+    public int lastIndexOf(final Object o) {
         final PathArgument srch = (PathArgument) Preconditions.checkNotNull(o);
 
         final int ret = stack.lastIndexOf(srch);