Optimize LazyContainerNode.getChild() 74/89274/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 22 Apr 2020 14:29:20 +0000 (16:29 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 22 Apr 2020 16:42:11 +0000 (16:42 +0000)
This just trims bytecode a bit by using an expression.

Change-Id: I20f8b6e10f42ff20f188f20991fbe0a8f0159396
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/LazyContainerNode.java

index 666b8d3372a9e6793ff2f59ceefec60e808658f9..6c877dce218bacdbda8926e2366f1cce44f2487a 100644 (file)
@@ -35,14 +35,13 @@ final class LazyContainerNode extends AbstractModifiedContainerNode {
         if (snapshot.size() == castData().size()) {
             return new MaterializedMutableContainerNode(this, snapshot);
         }
-
         return new LazyMutableContainerNode(this, snapshot);
     }
 
     @Override
     public Optional<TreeNode> getChild(final PathArgument childId) {
-        final TreeNode modified = getModifiedChild(childId);
-        return modified == null ? getChildFromData(childId) : Optional.of(modified);
+        final TreeNode modified;
+        return (modified = getModifiedChild(childId)) == null ? getChildFromData(childId) : Optional.of(modified);
     }
 
     @Override