This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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 REST with Spring (video course) this week in the Spring 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: 42959
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!