> From: Berin Loritsch [mailto:[EMAIL PROTECTED]]
>
> ------------------------------------------------------------------
> import java.util.*;
> import org.apache.avalon.excalibur.collections.ArrayStack;
>
> public class StackTest
> {
>   public static void main(String[] args)
>   {
>    int lInitialSize = Integer.parseInt(args[0]);
>    int lIterations = Integer.parseInt(args[1]);
>    ArrayList lArrayList = new ArrayList(lInitialSize + 1);
>    LinkedList lLinkedList = new LinkedList();
>    Stack lStack = new Stack();
>    ArrayStack lArrayStack = new ArrayStack();
>    long lBegin, lEnd;
>
>    for (int i = 0; i < lInitialSize; i++)
>    {
>     lArrayList.add(new Integer(i));
>     lLinkedList.add(new Integer(i));
>     lStack.push(new Integer(i));
>     lArrayStack.push(new Integer(i));
>    }
>
>    lBegin = System.currentTimeMillis();
>    for (int i = 0; i < lIterations; i++)
>    {
>     lArrayList.add(new Integer(i));  // Add to the tail
>     lArrayList.remove(lInitialSize);  // Remove from the tail
>    }

Just looking at the code - this only adds and removes the top item on the
stack,
which doesn't really exercise it properly. A FIFO is completely exercised
by the add one, remove one, but a stack is very nearly static...

As an arraylist will never shrink, while a linked list will, I wonder
how the contestants handle memory use.

(And, yes, I may make the required changes and try it.)

/LS



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to