Which one is better in performance between Array of type Object and ArrayList of type Object?
Assume we have a Array of Animal objects : Animal animal[] and a arraylist : ArrayList list<Animal>
Now I am doing animal[10] and list.get(10)
which one should be faster and why?
[]array will outperform the List by roughly a factor of 2-4. But that's multiplying times a very small amount of time. But if you ever need to resize the array or do something else more complex than simple set/access the List form will be quite a bit more convenient and likely a bit better performer.