Message from @ThisIsChris
Discord ID: 500186576597417984
I did this stuff like two years ago
I got a Java developer certificate when I graduated high school
and we did try catch and everything
```java
try {
your code;
}
catch Exception {
//leave empty lol
}
```
we also did Linked Lists I think
put that inside the method?
the entire method? @ThisIsChris
I'd put the `try` at line 148, just before the while loop, don't want that thing to go on catching exceptions forever waiting for the loop to break
so put the entire loop inside it?
so
```java
try {
//lines 149-163, the whole outer while loop, until just before the function ends
}
catch Exception {
//leave blank because we're supposed to assume nothing will happen
}
//then exit the function
}
``` @Jacob
thanks
okay now I have a new exception
here is my new code
```java
------------------testAddLast()----
Exception in thread "main" java.lang.NullPointerException
at MyLinkedList$ListNode.access$2(MyLinkedList.java:11)
at MyLinkedList.add(MyLinkedList.java:205)
at MyLinkedListTester.testAddLast(MyLinkedListTester.java:42)
at MyLinkedListTester.main(MyLinkedListTester.java:214)
```
That's good, different errors now
Unfortunately it's 2am here so I have to get to bed
okay thanks for your help
good night
by the way
for googling purposes
what I suggested with "try to see if it works, catch an exception if it doesn't" is called "duck typing" so for more info you can google "duck typing in java"
The idea of a function that can take in anything that implements a function (like the sort function that works on any node data that implements a `compareTo` function) is called "polymorphism"
though googling "polymorphism in Java didn't present any helpful examples to your problem, maybe you'll have better luck
ok good night
thanks a lot
good night
@ThisIsChris When you run the Reddit script, do you also get a bunch of duplicate comments?
I'm trying to figure out how to fix it right now
you can keep a (global) list or set with the text of every comment you've printed before, so that if the text is already found in your list of already printed comments, then you don't print it.
There's a few slightly more optimized ways to do it, but that would be the laziest fastest to implement
hmm ya that's what I'm trying to do
@Jacob what difficulty are you running into?
I added this in interested_comments():
interesting_list = []
and then I modified the if statements to be like this
if "white" in comment_set and {"priviledge", "privilege", "privledge"}.intersection(comment_set) and comment not in interesting_list:
I think I can figure this out, though
@ThisIsChris I'm testing out my solution right now