File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 42965
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.
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[]
It's not a secret anymore!