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 - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -