All pastes #210797 Raw Edit

Unnamed

public text v1 · immutable
#210797 ·published 2006-10-20 00:41 UTC
rendered paste body
package linkedList;

public class LinkedListTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		LinkedList list = new LinkedList();
		list.add(new Integer(1));
		list.add(new Integer(2));
		list.add(new Integer(3));
		list.add(new Integer(7), 2);
		
		String s = list.toString();
		System.out.println(s);
/*		try
		{
		list.add(5, new Integer(4));
		} 
		catch (Exception e)
		{
			System.err.println("Array out of bounds.");
		}*/
	}

}

	public String toString(ListNode list)
	{
		String s = "{";
		ListNode p = list;
		for(int i = 0; i < size(); i++ )
		{
			s += ((String) p.getValue());
			s += "->";
		}
		s+= "}";
		return s;
	}