|
|
@ -85,4 +85,24 @@ public class SimpleLinkedList<E> extends AbstractSimpleList<E> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private Node<E> getIndex(int i) { |
|
|
|
|
|
|
|
if (i < 0 || size <= i) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
Node<E> currentNode = firstNode; |
|
|
|
int currentIndex = 0; |
|
|
|
while (currentNode != null) { |
|
|
|
if (currentIndex >= i) { |
|
|
|
|
|
|
|
if (currentNode.getPayload() != null) { |
|
|
|
return currentNode; |
|
|
|
} |
|
|
|
} |
|
|
|
currentNode = currentNode.getSuccessor(); |
|
|
|
currentIndex++; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|