nodeRemove(currentNode,currentIndex);
return true;
}
private void nodeRemove(Node currentNode,int index) {
Node previousNode = currentNode.getPrevious();
Node nextNode = currentNode.getNext();
if (index == 0) {
nextNode.setPrevious(null);
firstNode = nextNode;
}
else {
previousNode.setNext(nextNode);
try {
nextNode.setPrevious(previousNode);
}
catch (java.lang.NullPointerException e) {
}
}
System.out.println("Data removed successfully!");