diff --git a/null-object/README.md b/null-object/README.md index 5b943630e..f5d92a7fc 100644 --- a/null-object/README.md +++ b/null-object/README.md @@ -141,11 +141,16 @@ public final class NullNode implements Node { Then we can construct and traverse the binary tree without errors as follows. ```java - Node root = - new NodeImpl("1", new NodeImpl("11", new NodeImpl("111", NullNode.getInstance(), - NullNode.getInstance()), NullNode.getInstance()), new NodeImpl("12", - NullNode.getInstance(), new NodeImpl("122", NullNode.getInstance(), - NullNode.getInstance()))); + var root = new NodeImpl("1", + new NodeImpl("11", + new NodeImpl("111", NullNode.getInstance(), NullNode.getInstance()), + NullNode.getInstance() + ), + new NodeImpl("12", + NullNode.getInstance(), + new NodeImpl("122", NullNode.getInstance(), NullNode.getInstance()) + ) + ); root.walk(); // 1 diff --git a/null-object/src/main/java/com/iluwatar/nullobject/App.java b/null-object/src/main/java/com/iluwatar/nullobject/App.java index 00cff9fc9..cd35a3042 100644 --- a/null-object/src/main/java/com/iluwatar/nullobject/App.java +++ b/null-object/src/main/java/com/iluwatar/nullobject/App.java @@ -37,7 +37,7 @@ public class App { * @param args command line args */ public static void main(String[] args) { - Node root = new NodeImpl("1", + var root = new NodeImpl("1", new NodeImpl("11", new NodeImpl("111", NullNode.getInstance(), NullNode.getInstance()), NullNode.getInstance()