Returns true if the string represented - by the object it is on the same string is represented by the object str. Otherwise false is returned. This system must write the recursion without using any loops.
So I did it and it looks like this:
public boolean equals ( StringList str )
{
if ((str._head == null) && (_head == null) )
return true;
else
if( str._head.getData()==_head.getData() && str._head.getValue() == _head.getValue())
{
_head = _head.getNext();
str._head = str._head.getNext();
return equals( str);
}
return false;
}
The problem is that I lose the head of the list and the entire list that as I progress I run over it .