Resolves checkstyle errors for naked-objects null-object object-mother object-pool observer queue-load-leveling (#1082)
* Reduces checkstyle errors in naked-objects * Reduces checkstyle errors in null-object * Reduces checkstyle errors in object-mother * Reduces checkstyle errors in object-pool * Reduces checkstyle errors in observer * Reduces checkstyle errors in queue-load-leveling
This commit is contained in:
committed by
Ilkka Seppälä
parent
1e76d91929
commit
6ef840f3cf
@ -24,18 +24,16 @@
|
||||
package com.iluwatar.nullobject;
|
||||
|
||||
/**
|
||||
*
|
||||
* Null Object pattern replaces null values with neutral objects. Many times this simplifies
|
||||
* algorithms since no extra null checks are needed.
|
||||
* <p>
|
||||
* In this example we build a binary tree where the nodes are either normal or Null Objects. No null
|
||||
* values are used in the tree making the traversal easy.
|
||||
*
|
||||
* <p>In this example we build a binary tree where the nodes are either normal or Null Objects. No
|
||||
* null values are used in the tree making the traversal easy.
|
||||
*/
|
||||
public class App {
|
||||
/**
|
||||
* Program entry point
|
||||
*
|
||||
* Program entry point.
|
||||
*
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
@ -44,7 +42,7 @@ public class App {
|
||||
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())));
|
||||
NullNode.getInstance())));
|
||||
|
||||
root.walk();
|
||||
}
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.nullobject;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for binary tree node.
|
||||
*
|
||||
*/
|
||||
public interface Node {
|
||||
|
||||
|
@ -27,9 +27,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* Implementation for binary tree's normal nodes.
|
||||
*
|
||||
*/
|
||||
public class NodeImpl implements Node {
|
||||
|
||||
@ -40,7 +38,7 @@ public class NodeImpl implements Node {
|
||||
private final Node right;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*/
|
||||
public NodeImpl(String name, Node left, Node right) {
|
||||
this.name = name;
|
||||
|
@ -24,17 +24,16 @@
|
||||
package com.iluwatar.nullobject;
|
||||
|
||||
/**
|
||||
*
|
||||
* Null Object implementation for binary tree node.
|
||||
* <p>
|
||||
* Implemented as Singleton, since all the NullNodes are the same.
|
||||
*
|
||||
* <p>Implemented as Singleton, since all the NullNodes are the same.
|
||||
*/
|
||||
public final class NullNode implements Node {
|
||||
|
||||
private static NullNode instance = new NullNode();
|
||||
|
||||
private NullNode() {}
|
||||
private NullNode() {
|
||||
}
|
||||
|
||||
public static NullNode getInstance() {
|
||||
return instance;
|
||||
|
Reference in New Issue
Block a user