This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes array list and string[] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "array list and string[]" Watch "array list and string[]" New topic

array list and string[]

pippiri venu

Joined: Apr 19, 2005
Posts: 8
which one is the best?
and why?

array list or string[]

venu gopal p
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41133
That depends greatly on what you're doing with it. Arrays offer slightly better performance (there is less overhead to deal with), but ArrayList is more flexible (you can add and delete elements).
I prefer Collections for their convenience, which to me is almost always more important than speed.

Ping & DNS - my free Android networking tools app
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Before Java 5.0, arrays also provided type-checking that was missing from Collections (such as ArrayList). With generics, this is mitigated somewhat.


Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: array list and string[]
Similar Threads
Inferring the correct type parameter
Vector and Array please help
h:dataTable Issue
String[ ] to File[ ]