Message from @Jacob

Discord ID: 500183420031205376


2018-10-12 05:11:03 UTC  

where?

2018-10-12 05:11:19 UTC  

and why would that make the compareTo method undefined?

2018-10-12 05:11:51 UTC  

before sorted

2018-10-12 05:11:56 UTC  

second line

2018-10-12 05:12:15 UTC  

Doesn't look like it's closed

2018-10-12 05:15:52 UTC  

nah all the parentheses are closed

2018-10-12 05:15:58 UTC  

I changed it to the one Chris sent

2018-10-12 05:16:08 UTC  

I'm not getting any errors from parentheses

2018-10-12 05:18:19 UTC  

@Jacob `data` is an Object, how do you know it implements the Comparable interface?

2018-10-12 05:18:37 UTC  

```java
javac Tester.java
./CDoublyLinkedList.java:155: error: cannot find symbol
(sortedCurr.data.compareTo(curr.data) > 0)) {
^
symbol: method compareTo(Object)
location: variable data of type Object
1 error
```

2018-10-12 05:21:28 UTC  

is there a way I can make it implement comparable class?

2018-10-12 05:21:39 UTC  

I'm not sure how much I'm supposed to modify this assignment

2018-10-12 05:21:50 UTC  

or is there a better way to do insertion sort?

2018-10-12 05:39:58 UTC  
2018-10-12 05:42:01 UTC  

You can try to call the compareTo method and then catch an Exception if compareTo is not implemented

2018-10-12 05:43:58 UTC  

how do I do that?

2018-10-12 05:44:30 UTC  

I feel like there's a better way that I'm missing, since this is part of the assignment and I don't think he wants us to modify the given code

2018-10-12 05:44:40 UTC  

well, besides filling in the methods

2018-10-12 05:49:26 UTC  
2018-10-12 05:50:20 UTC  

maybe I could cast the object?

2018-10-12 05:50:26 UTC  

the tester class only uses characters

2018-10-12 05:52:11 UTC  

@Jacob Cast it as Comparable?

2018-10-12 05:52:24 UTC  

or maybe as a char

2018-10-12 05:52:30 UTC  

or integer if that's possible

2018-10-12 05:52:32 UTC  

I don't know

2018-10-12 05:53:08 UTC  
2018-10-12 05:54:06 UTC  

@Jacob
line 4
```java
private Object data; //Assume data implemented Comparable
```

2018-10-12 05:54:23 UTC  

OK... you can assume that, but Java is going to want that declared somewhere

2018-10-12 05:54:31 UTC  

or it will refuse to compile

2018-10-12 05:54:44 UTC  

I think he really may want you to try/catch

2018-10-12 05:54:54 UTC  

God

2018-10-12 05:54:58 UTC  

I did this stuff like two years ago

2018-10-12 05:55:11 UTC  

I got a Java developer certificate when I graduated high school

2018-10-12 05:55:16 UTC  

and we did try catch and everything

2018-10-12 05:55:26 UTC  

```java
try {
your code;
}
catch Exception {
//leave empty lol
}
```

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?