All pastes #210793 Raw Edit

Untitled

public text v1 · immutable
#210793 ·published 2006-10-20 00:35 UTC
rendered paste body
public void add (int index, Object obj)
	{
		ListNode p = head;
		
		if (index < 0 || index > size())
			throw new ArrayIndexOutOfBoundsException();
		if (index == 0)
		{
			head = new ListNode (obj, head);
								
		}
		else if (index == size())
			add(obj);
		else if (index != size() && index!= 0)
			for(int i = 0; i == index-1; i++)
			{
				p = p.getNext();	
			}
			
			p.setNext(new ListNode (obj, p.getNext()));