File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

array list and string[]

pippiri venu
Greenhorn

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

array list or string[]


venu gopal p
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41816
    
  62
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.

Layne


Java API Documentation
The Java Tutorial
 
Don't get me started about those stupid light bulbs.
 
subject: array list and string[]