Refactors null object pattern to java-11

This commit is contained in:
Anurag Agarwal
2020-08-08 00:46:08 +00:00
parent a5038c4329
commit 8e060ad0ad
4 changed files with 35 additions and 36 deletions

View File

@ -37,12 +37,16 @@ public class App {
* @param args command line args
*/
public static void main(String[] args) {
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())));
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())
)
);
root.walk();
}