Optimize ImmutableNodes.leafNode()
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / ImmutableNodes.java
index 84459e948ca279b1c772ebb3624b883824f15ee5..28310400acea3bfd7692dc8547c14fc9863a4847 100644 (file)
@@ -105,10 +105,7 @@ public final class ImmutableNodes {
      * @return Leaf node with supplied identifier and value
      */
     public static <T> @NonNull LeafNode<T> leafNode(final NodeIdentifier name, final T value) {
-        return ImmutableLeafNodeBuilder.<T>create()
-                .withNodeIdentifier(name)
-                .withValue(value)
-                .build();
+        return ImmutableLeafNodeBuilder.createNode(name, value);
     }
 
     /**
@@ -126,7 +123,7 @@ public final class ImmutableNodes {
     public static @NonNull DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder(
             final QName nodeName, final QName keyName, final Object keyValue) {
         return ImmutableMapEntryNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifierWithPredicates(nodeName, keyName, keyValue))
+                .withNodeIdentifier(NodeIdentifierWithPredicates.of(nodeName, keyName, keyValue))
                 .withChild(leafNode(keyName, keyValue));
     }