Do not instantiate needless objects in augment
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / CaseEffectiveStatementImpl.java
index c21e0865ab41d718ef79be2faa91299e99906785..7cc26e6a1df54ed82caa3a326ea827919a6ee44f 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import com.google.common.base.Optional;
-import java.util.Collection;
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
@@ -29,17 +28,12 @@ public final class CaseEffectiveStatementImpl extends AbstractEffectiveSimpleDat
         this.original = (ChoiceCaseNode) ctx.getOriginalCtx().map(StmtContext::buildEffective).orElse(null);
 
         if (ctx.isConfiguration()) {
-            configuration = isAtLeastOneChildConfiguration(ctx.declaredSubstatements())
-                    || isAtLeastOneChildConfiguration(ctx.effectiveSubstatements());
+            configuration = ctx.allSubstatementsStream().anyMatch(StmtContext::isConfiguration);
         } else {
             configuration = false;
         }
     }
 
-    private static boolean isAtLeastOneChildConfiguration(final Collection<? extends StmtContext<?, ?, ?>> children) {
-        return children.stream().anyMatch(StmtContext::isConfiguration);
-    }
-
     @Override
     public Optional<ChoiceCaseNode> getOriginal() {
         return Optional.fromNullable(original);