All your methods in themselves are universal. That way, they have their own type parameter, which has nothing to do with the one declared with your class. Method declaration below:
public <T> boolean insertHead(T newEntry)
, , , T . , <T> . , , :
public boolean insertHead(T newEntry)
, T Object, . :
public <T> Object get(int givenPosition)
{
if ((givenPosition >= 1) && (givenPosition <= size))
return contents[givenPosition - 1];
return null;
}
public T get(int givenPosition)
{
if ((givenPosition >= 1) && (givenPosition <= size))
return (T) contents[givenPosition - 1];
return null;
}