I prefer to use Arrays over ArrayLists whenever I know I am only going to work with a fixed number of elements. My reasons are mostly subjective, but I'm listing them here anyway:
Using Collection classes for primitives is appreciably slower since they have to use autoboxing and wrappers.
I prefer the more straightforward  syntax for accessing elements over ArrayList's get(). This really becomes more important when I need multidimensional arrays.
ArrayLists usually allocate about twice the memory you need now in advance so that you can append items very fast. So there is wastage if you are never going to add any more items.
(Possibly related to the previous point) I think ArrayList accesses are slower than plain arrays in general. The ArrayList implementation uses an underlying array, but all accesses have to got through the get(), set(), remove(), etc. methods which means it goes through more code than a simple array access. But I have not actually tested the difference so I may be wrong.
Having said that, I think the choice actually depends on what you need it for. If you need a fixed number of elements or if you are going to use multiple dimensions, I would suggest a plain array. But if you need a simple random access list and are going to be making a lot of inserts and removals to it, it just make a lot more sense to just use an Arraylist
Also one of the great benefits of collection implementations is they give you a lot of flexibility. So depending on your need, you can have a List behave as an ArrayList or as a LinkedList and so on. Also if you look at the Collection API, you'd see you have methods for almost everything you'd ever need to do.
I'd always give preference to flexibility cause being able to adapt to change is an implied requirement almost always.
The concurrent API gives you multi-threading support and hence even more flexibility.
Another thing to consider might be Arrays.asList() and List.toArray() methods. As far as I remember Arrays.asList() makes the changes in both the array and the List whereas the Array you get after List.toArray() is an array that is unaffected by the changes to the source List. However I'm not sure about this last point. You might want to test it.
Joined: Jul 07, 2012
I now know that arrayList consumes more memory than ArrayList.Iwill read more on that.
Bear Bibeault wrote
I will almost always use a List implementation (not always ArrayList) in place of arrays. Worrying about the extra memory it may consume is a micro-optimization that is almost always needless.
If developers almost always use ArrayList then why does Array also exist in Java.? If everything that array provides is provided by ArrayList with more advantages then why would array ever be used?
Off the top of my head, I'd use an array if I was setting up a static list of things. Also, many APIs expect or return arrays. Or, if I have any reason to think an array would make things clearer than a List.
Monica. Shiralkar wrote:Are there cases when normal array should be used instead of ArrayList?
I missed one, and it's quite important:
When elements are sparse; ie, when removing an element doesn't affect the position of the others. This usually means that the array can't hold nulls.
This is a major difference between arrays and Lists. The only normal way to "remove" an element from an array is to set it to null or, in the case of a primitive array, to some value that can't possibly be "real". The indexes of other elements are not affected.
Joined: Jul 07, 2012
Thanks. I have a doubt. In array we can assign a a particular position by below syntax:
Why we do not have such kind of syntax for assigning at particular position in arrayList? I know its possible by why no stratightforward syntax for doing this in arrayList.