Make getOriginalCtx() give out an Optional
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / LeafListEffectiveStatementImpl.java
index 9a3e9f1672deabea4e45a9d65723f9688434b65a..fc779aef34cf5df68fa91826010f3e1cbc0fd1b5 100644 (file)
@@ -37,8 +37,7 @@ public final class LeafListEffectiveStatementImpl extends AbstractEffectiveDataS
     public LeafListEffectiveStatementImpl(
             final StmtContext<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> ctx) {
         super(ctx);
-        this.original = ctx.getOriginalCtx() == null ? null : (LeafListSchemaNode) ctx.getOriginalCtx()
-                .buildEffective();
+        this.original = (LeafListSchemaNode) ctx.getOriginalCtx().map(StmtContext::buildEffective).orElse(null);
 
         final TypeEffectiveStatement<?> typeStmt = SourceException.throwIfNull(
             firstSubstatementOfType(TypeEffectiveStatement.class), ctx.getStatementSourceReference(),