Galbreath, Mark wrote:
> That's pretty weird, considering an ArrayList has an initial capacity of 10
> and grows automatically.  Are you sure you are re-instantiating the List
> after (I assume) dereferencing it in reset()?

        This "grows automatically" part is something that I think is not 
completely right. If you always call "add()" then OK, it grows 
automatically. But try:

        ArrayList a = new ArrayList();
        a.set(30, Boolean.TRUE);

        And you get an ArrayIndexOutOfBoundsException.

        Greg, if there's a way to know the size of the collection you'll need to 
store your data, you may call the ensureCapacity(int) method when you 
instantiate the ArrayList.

        Or you can instantiate a "big enough" ArrayList and later call trimToSize().

-- 
[]'s
Marcelo Vanzin
Touch Tecnologia
[EMAIL PROTECTED]
"Life is too short to drink cheap beer"


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to