![]() ![]() |
| |||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
public void insertAfterNext(LLNode twoBefore, LLnode newOne){
if (twoBefore.getNext() == null) {
twoBefore.insertAfter(newOne);
}
else {
LLNode oneBefore = twoBefore.getNext();
LLNode oneAfter = oneBefore.getNext();
oneBefore.setNext(newOne);
newOne.setNext(oneAfter);
}
} |
public void insertAfterNext(LLNode node){
if (this.getNext() != null){
this.getNext().insertAfter(node);
}
else{
this.insertAfter(node);
}
} |