compareTo method for doubly linked list

Hey, im trying to figure out how to write a comparTo method for my circular doubly linked list. Ive only writen one for primitive data types link int. So I cant figure out how to make it work for a linked list. Ive tried lots of different ways and combinations but I cant get the syntax right so it wont even compile. Im useing it for a sorting routine so I want it to look at 2 elements at a time and switch if one is greater or do nothing if they are the same.
public class Node implements Comparable<Node>
	Node next;
	Node prev;
	Object data;
	public int compareTo(Node that) 
		if(( > 0)
		return 1;
		return 0;

//..... rest of Node class

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
should just need this

      public int compareTo(Node that)
             return ((Comparable)data).compareTo((Compable);

nb: you'll need to ensure the data objects implement Comparable (so you can compare them)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
theldroAuthor Commented:
Thanks that worked good
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.