Advertisement
FosterPatch

Untitled

Sep 23rd, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. public void insert(int index, E item) {
  2. if ( index < 0 || index > size) {
  3. throw new IndexOutOfBoundsException(Integer.toString(index));
  4. }
  5. if (index == 0) {
  6. append(item);
  7. size++;
  8. } else {
  9. Node<E> current = currentNode;
  10. while(current.getNext()!= null) current = current.getNext();
  11. current = new Node<E> (item);
  12.  
  13. }
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement