aboutsummaryrefslogtreecommitdiffstats
path: root/csci1913/Java/project3
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-12-11 12:50:56 -0600
committerRossTheRoss <msattr@gmail.com>2019-12-11 12:50:56 -0600
commit8a03144a43feb940dafe06bed8ccb83269b94d35 (patch)
tree412f7f7bcfb2d92a2cea1c23295c2c97664abd69 /csci1913/Java/project3
parentChange things (diff)
downloadhomework-8a03144a43feb940dafe06bed8ccb83269b94d35.tar
homework-8a03144a43feb940dafe06bed8ccb83269b94d35.tar.gz
homework-8a03144a43feb940dafe06bed8ccb83269b94d35.tar.bz2
homework-8a03144a43feb940dafe06bed8ccb83269b94d35.tar.lz
homework-8a03144a43feb940dafe06bed8ccb83269b94d35.tar.xz
homework-8a03144a43feb940dafe06bed8ccb83269b94d35.tar.zst
homework-8a03144a43feb940dafe06bed8ccb83269b94d35.zip
Get rid of kludge try-catch and replace with if
Diffstat (limited to 'csci1913/Java/project3')
-rw-r--r--csci1913/Java/project3/project3_strap012.java14
1 files changed, 3 insertions, 11 deletions
diff --git a/csci1913/Java/project3/project3_strap012.java b/csci1913/Java/project3/project3_strap012.java
index 16290aa..0bed110 100644
--- a/csci1913/Java/project3/project3_strap012.java
+++ b/csci1913/Java/project3/project3_strap012.java
@@ -69,7 +69,7 @@ class AnagramTree {
}
private void findAnagrams(TreeNode subtree) {
- try {
+ if (subtree != null) {
if (subtree.words.next != null) {
System.out.println();
while (subtree.words != null) {
@@ -78,16 +78,8 @@ class AnagramTree {
subtree.words = subtree.words.next;
}
}
- if (subtree != null) {
- findAnagrams(subtree.left);
- findAnagrams(subtree.right);
- }
- } catch (NullPointerException ignore) {
- /*
- This exception exists as a kludge for any time
- subtree is null. The program does bad things
- if this is not present.
- */
+ findAnagrams(subtree.left);
+ findAnagrams(subtree.right);
}
}