Hey, got a Java assignment due in for my uni in a few hours, and I still have no godly idea what I'm doing with generics. See I have:
public E next()
{
E value;
if(hasNext())
{
value=iterNext.getValue();
iterNext=iterNext.getNext();
}
else
{
value=null;
}
return value;
}
As part of a tailored linked list, and now we have to make it generic (was handling Object class objects before, and I understand WHY WE SWITCHED, I just don't really get HOW TO WORK WITH IT)
.getValue() is simply:
public E getValue()
{
return value;
}
Where value has been declared as E
However, based on the compiler output, it looks like getValue() is still trying to hand back an Object, but I don't get why... any help forthcoming?
...Where's my stupid?
Updated by AmericanExistence