my dog learned polymorphism*
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 Java 8 in Action this week in the Java 8 forum!
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: 39570
    
  27
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 - updated with new look and Ping home screen widget
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: array list and string[]
 
Similar Threads
Inferring the correct type parameter
h:dataTable Issue
Set.toArray
Vector and Array please help
String[ ] to File[ ]