Message from @ThisIsChris

Discord ID: 500186959654682627


2018-10-12 05:55:27 UTC  

we also did Linked Lists I think

2018-10-12 05:55:40 UTC  

put that inside the method?

2018-10-12 05:55:52 UTC  

the entire method? @ThisIsChris

2018-10-12 05:56:34 UTC  

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

2018-10-12 05:56:49 UTC  

so put the entire loop inside it?

2018-10-12 05:58:28 UTC  

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

2018-10-12 06:00:16 UTC  

thanks

2018-10-12 06:00:21 UTC  

okay now I have a new exception

2018-10-12 06:00:43 UTC  

here is my new code

2018-10-12 06:00:47 UTC  

https://cdn.discordapp.com/attachments/352761432833523713/500186049079934986/StartupCode.zip

2018-10-12 06:01:06 UTC  

```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)
```

2018-10-12 06:01:10 UTC  
2018-10-12 06:02:12 UTC  

That's good, different errors now

2018-10-12 06:02:21 UTC  

Unfortunately it's 2am here so I have to get to bed

2018-10-12 06:02:39 UTC  

okay thanks for your help

2018-10-12 06:02:41 UTC  

good night

2018-10-12 06:02:52 UTC  

good night

2018-10-12 06:02:59 UTC  

by the way

2018-10-12 06:03:03 UTC  

for googling purposes

2018-10-12 06:03:34 UTC  

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"

2018-10-12 06:04:24 UTC  

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"

2018-10-12 06:04:59 UTC  

though googling "polymorphism in Java didn't present any helpful examples to your problem, maybe you'll have better luck

2018-10-12 06:05:01 UTC  

ok good night

2018-10-12 06:05:33 UTC  

thanks a lot

2018-10-12 06:05:35 UTC  

good night

2018-10-13 05:14:50 UTC  

@ThisIsChris When you run the Reddit script, do you also get a bunch of duplicate comments?

2018-10-13 05:15:01 UTC  

I'm trying to figure out how to fix it right now

2018-10-13 05:17:50 UTC  

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.

2018-10-13 05:18:15 UTC  

There's a few slightly more optimized ways to do it, but that would be the laziest fastest to implement

2018-10-13 05:18:17 UTC  

hmm ya that's what I'm trying to do

2018-10-13 05:20:22 UTC  

@Jacob what difficulty are you running into?

2018-10-13 05:28:58 UTC  

I added this in interested_comments():

2018-10-13 05:29:01 UTC  

interesting_list = []

2018-10-13 05:29:17 UTC  

and then I modified the if statements to be like this

2018-10-13 05:29:19 UTC  

if "white" in comment_set and {"priviledge", "privilege", "privledge"}.intersection(comment_set) and comment not in interesting_list:

2018-10-13 05:29:28 UTC  

I think I can figure this out, though

2018-10-13 05:37:34 UTC  

@ThisIsChris I'm testing out my solution right now

2018-10-13 05:37:46 UTC  

In the meantime, I have some new ideas

2018-10-13 05:38:27 UTC  

How difficult do you think it would be to add this functionality? Detect what specific immigration topic is about, and automatically suggest counterarguments from a database.

2018-10-13 05:39:27 UTC  

Maybe I could put the arguments in a list, and look for phrases like "jobs Americans won't do" and the script would immediately pop out a refutation

2018-10-13 05:39:57 UTC  

I think it would be pretty straightforward. You need a list keywords/key phrases that indicate the topic of conversation, then you just need a pre-written counter argument for each topic