Message from @Jacob
Discord ID: 500173535369756673
Thanks!
You're welcome! I tried to be thorough with the comments but let me know if there's anything unclear
<@&435155896780324864> Anyone online to help me with Java?
Depends, I took it last spring and I'm doing C++ now. What'd you need?
to find out what's wrong with this program
okay this is the right one
Is it not compiling?
There's an error on line 155 in the CDoublyLinkedList class
I'm not sure how to compare the objects
what is the purpose of the program?
to make a circular doubly linked list and test it
@ThisIsChris can you help me with this?
@Jacob
line 155-156 is:
```java
if (sortedCurr.data.equals(curr.data) ||
sortedCurr.data.compareTo(curr.data) > 0)
```
I'll let Chris handle this one.
try changing it to:
```java
if ( (sortedCurr.data.equals(curr.data)) ||
(sortedCurr.data.compareTo(curr.data) > 0) )
```
it still gives an error
What's the error?
"The method compareTo(Object) is undefined for the type Object"
You're missing a (
and why would that make the compareTo method undefined?
before sorted
second line
Doesn't look like it's closed
nah all the parentheses are closed
I changed it to the one Chris sent
I'm not getting any errors from parentheses
@Jacob `data` is an Object, how do you know it implements the Comparable interface?
```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
```
is there a way I can make it implement comparable class?
I'm not sure how much I'm supposed to modify this assignment
or is there a better way to do insertion sort?
You can try to call the compareTo method and then catch an Exception if compareTo is not implemented
how do I do that?
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
well, besides filling in the methods
maybe I could cast the object?