java - Singly Linked List Delete Value -


i making singly linked list need put delete method getting error help?

public void remove(int index) {     getnode(index - 1).next = getnode(index + 1); } 

many possible errors can happen here. one, definitively put more verification before making changes if

  • are on first element (then header 2nd element);
  • are on last element (then getnode(index+1) returning correctly null or throwing exception)?

Comments

Popular posts from this blog

javascript - ScrollTo Effect (href to div) -

javascript - ng-class not responding to change in model in Angular? -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -