diff options
| author | EVE <EVE@EVE-PC> | 2017-03-14 12:07:14 -0400 |
|---|---|---|
| committer | EVE <EVE@EVE-PC> | 2017-03-14 12:07:14 -0400 |
| commit | 504ca816530efdff06bc202e0432ebd354aec304 (patch) | |
| tree | 4836932fb81d1d625470502c78c94d202c9a7420 /BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeLeaf.java | |
| parent | 5c1163df17c46f7d3e15b6c7949c38843ec56146 (diff) | |
Cleanup
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeLeaf.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeLeaf.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeLeaf.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeLeaf.java index 04765b4..2696577 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeLeaf.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/BinarySearchTreeLeaf.java @@ -7,7 +7,7 @@ import java.util.function.Predicate; /** * A leaf in a tree. - * + * * @author ben * * @param <T> @@ -26,7 +26,7 @@ public class BinarySearchTreeLeaf<T> implements ITreePart<T> { /** * Create a new leaf holding the specified data. - * + * * @param element * The data for the leaf to hold. */ @@ -41,9 +41,7 @@ public class BinarySearchTreeLeaf<T> implements ITreePart<T> { @Override public <E> E collapse(Function<T, E> leafTransformer, BiFunction<E, E, E> branchCollapser) { - if (leafTransformer == null) { - throw new NullPointerException("Transformer must not be null"); - } + if(leafTransformer == null) throw new NullPointerException("Transformer must not be null"); return leafTransformer.apply(data); } @@ -60,18 +58,16 @@ public class BinarySearchTreeLeaf<T> implements ITreePart<T> { @Override public void delete(T element, Comparator<T> comparator) { - if (data.equals(element)) { + if(data.equals(element)) { isDeleted = true; } } @Override public boolean directedWalk(DirectedWalkFunction<T> treeWalker) { - if (treeWalker == null) { - throw new NullPointerException("Tree walker must not be null"); - } + if(treeWalker == null) throw new NullPointerException("Tree walker must not be null"); - switch (treeWalker.walk(data)) { + switch(treeWalker.walk(data)) { case SUCCESS: return true; // We don't have any children to care about @@ -85,9 +81,7 @@ public class BinarySearchTreeLeaf<T> implements ITreePart<T> { @Override public boolean forEach(TreeLinearizationMethod linearizationMethod, Predicate<T> traversalPredicate) { - if (traversalPredicate == null) { - throw new NullPointerException("Predicate must not be null"); - } + if(traversalPredicate == null) throw new NullPointerException("Predicate must not be null"); return traversalPredicate.test(data); } |
