All pastes #994628 Raw Edit

test

public java v1 · immutable
#994628 ·published 2008-04-23 15:24 UTC
rendered paste body
import java.util.*;public class AddListsTest{	static long start, end;	static List l;	static Object foo = new Object();	public static void main(String args[])	{		final int iter = 2000000;		if (args[0].equals("ArrayList"))		{			// add			start = System.currentTimeMillis();			l = new ArrayList();			for (int i = 0; i < iter; i++)				l.add(foo);			end = System.currentTimeMillis();			System.out.println("ArrayList time: "+(end-start)+" ms");		}		else		{			// add			start = System.currentTimeMillis();			l = new LinkedList();			for (int i = 0; i < iter; i++)				l.add(foo);			end = System.currentTimeMillis();			System.out.println("LinkedList time: "+(end-start)+" ms");		}	}}