Hi Everyone
I am new to Java and trying to work on an exercise for college.
I am busy with Linked Lists and Doubly Linked Lists and I have created my main classes. However in my List class I am trying to create a remove method and have tried various ways of getting there and keep on getting different error messages.
All I am suppose to get is that Remove should extract the given element from my list and then return it.
My Error is as followsincompatible types - found Node<T> but expected TCode:public T remove() throws NoSuchElementException
{
if (isEmpty() )
{
throw new NoSuchElementException("Attempt to remove item from an empty queue.");
}
else
{
return head=tail;
}
}
I also tried the following which did not give me an error but I am sure its not what is really needed
Can anyone just direct me in the right direction please because I really dont want to start dreaming code.Code:public void remove()
{
if ( empty() )
throw new EmptyStackException();
else
{
head = tail;
}
}
Thanks in advance
PS: I am using BlueJ for my code

