Operator < cannot be applied to java.lang.Object, Object
Hi,I am making a program with a linked list and nodes and i am trying to use the generic templates.
This is an example of what i put to define my class 'public class LinkedList<Object>' and then put Object for the type throughout the code. So far it has worked for the Node class and now i am trying to get it to work on the LinkedList class.
The problem i am having is i am comparing to Object items for a sorting method to put the linked list in order.
Code:
public void insertion(Object grad, Object y_int)
{
boolean found = false;
current = head_ptr;
while (found == false && current != sentinel)
{
if (numberOfNodes == 0)
{
//std::cout << "in insertion numbernodes = 0" << endl;
addToTail(grad, y_int);
found = true;
}
else
{
if (current.get_Data_x() == grad)
{
if (current.get_Data_y() < y_int) --------- this is the line that has the problem.
I get the error 'operator < cannot be applied to java.lang.Object, Object'.
Can anyone tell me how i can fix this problem or know what it could be?
Thanks
Albert:rolleyes: