Q:

When would ArrayList-add/Array-get List Builder be faster than ArrayList?

I trying to implement a Builder-pattern that is comparable to LinkedList when adding and comparable to ArrayList when getting. 
When the function f() is chosen to be "(int)(Math.random() * ((len) + 1))" and N is chosen to be 100000, my implementation is only just about as fast as ArrayList (and both are about 1000 times faster than LinkedList).
So, could anyone give me any pointers towards solving this? Either by rethinking my implementation, or by finding a function f() that fulfils the requirements?

A:

When you convert your ArrayList to Array you use time,and that makes your implementation not optimal.
Also the implementation of ArrayList is based directly in Arrays and the method get is O(1).
If you want to do something faster than ArrayList you have to code your own class.

