So I wrote a linkList that holds a student reference and a next reference. I have no issue with insertion. On the other hand, I need help with deletion and finding the item. So basically I'm using the find method to find a student reference to a string. Then using a delete method to delete the node corresponding with that reference.
public void deleteStudentNode(StudentNode delete)
{
StudentNode it = new StudentNode();
delete = shead;
it = shead;
//StudentNode b = new StudentNode();
while(it.getSptr() != findStudentByName(""))
{
delete = it;
it = it.getSptr();
}
delete.setSptr(null);
setShead(delete);
//d.setStudent(null);
}
public StudentNode findStudentByName (String findName)
{
StudentNode find = shead;
while(find.getStudent().getName() != findName)
{
if(find.getSptr() == null)
return null;
else
find = find.getSptr();
}
return find;
}