Even though it performs the desired operation is the method valid for removing elements for linked list???
public void removeAt(int index) throws Exception {
if(index>=this.size){
throw new Exception("INVALID INPUT");
}
if(index==0) removeFirst();
else if(index==this.size-1) removeLast();
else {
getNode(index - 1).next = getNode(index).next;
this.size--;
}
}