public void delete(int index)
{
if (index < 0 || index > _____)
{
throw new ArrayIndexOutOfBoundsException();
}
{
Node<X> current = head;
for (int i = 0; i < index; i++)
{
current = current.getLink();
}
Node<X> newNode = new Node<X>();
newNode.setLink(current.getLink());
current.setLink(newNode);
}
}
So I can't seem to figure out the logic in writing an outofbounds exception for index when using node objects. It's not like i can do head.length, so would i use a .getLink loop first to find the Null? It's not like I can do index != null either.