Fixup SchemaNodeIdentifier design
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / StmtContextUtils.java
index 4a1ef8e113878c7019dc2d9c0d2aaeac458bface..69894692853ba984b78425148607ed155e58d4ac 100644 (file)
@@ -12,6 +12,7 @@ import static java.util.Objects.requireNonNull;
 
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
 import java.util.Collection;
 import java.util.Optional;
 import java.util.Set;
@@ -446,7 +447,7 @@ public final class StmtContextUtils {
     private static boolean isListKey(final StmtContext<?, ?, ?> leafStmtCtx,
             final StmtContext<Collection<SchemaNodeIdentifier>, ?, ?> keyStmtCtx) {
         for (final SchemaNodeIdentifier keyIdentifier : keyStmtCtx.coerceStatementArgument()) {
-            if (leafStmtCtx.getStatementArgument().equals(keyIdentifier.getLastComponent())) {
+            if (leafStmtCtx.getStatementArgument().equals(Iterables.getLast(keyIdentifier.getNodeIdentifiers()))) {
                 return true;
             }
         }