Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void add(int i, Object obj)
- {
- if(i < 0 || i >= nodeCount)
- throw new IndexOutOfBoundsException();
- ListNode node = head, prev = null;
- for(int j = 0; j < i; j++)
- node = node.getNext();
- prev = node;
- node = node.getNext();
- ListNode add = new ListNode(obj,node);
- prev.setNext(add);
- }
Add Comment
Please, Sign In to add comment