Refactors null object pattern to java-11
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user