Node: may be empty, having no data
* isEmpty()
This commit is contained in:
parent
921cf98b13
commit
36efe5d83a
2 changed files with 12 additions and 0 deletions
|
@ -20,6 +20,13 @@ public interface Node<T> {
|
|||
*/
|
||||
T getData();
|
||||
|
||||
/**
|
||||
* Returns true if the node is empty (has no data).
|
||||
*
|
||||
* @return true is data is null
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Fetch the parent node.
|
||||
* <p>
|
||||
|
|
|
@ -50,6 +50,11 @@ public class NodeItem<T> implements Node<T> {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return data == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node<T> getParent() {
|
||||
return parent;
|
||||
|
|
Loading…
Reference in a new issue