wood burning stoves*
The moose likes Beginning Java and the fly likes List 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 » Beginning Java
Bookmark "List" Watch "List" New topic
Author

List

mike cool
Greenhorn

Joined: Oct 21, 2005
Posts: 24
hey
i have a non fixed size list of main catogeries and from each catogory i will have non fixed size list of items
what i need to use for this
LinkedList or ArrayList or Vactor , ..etc?
note this list will be wriiten to desk
thx
Paul Santa Maria
Ranch Hand

Joined: Feb 24, 2004
Posts: 236
ArrayList might be a good first choice...


Paul M. Santa Maria, SCJP
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

LinkedList, ArrayList, Vector are all implementations of the interface List (in the package java.util). For the functionality of the program, it doesn't really matter which implementation you use - they should all have the same behaviour (functionally).

Which one is best depends on non-functional requirements. For example, LinkedList is more efficient than ArrayList when you often want to insert elements in the middle of the list, and ArrayList is more efficient than LinkedList when looking up elements by index; Vector is synchronized, while ArrayList and LinkedList are not (which is important when writing multi-threaded programs).

If you're just trying to get your program to work (and you're not yet in the stage of optimizing it), it doesn't really matter which implementation of List you choose.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: List
 
Similar Threads
Split String to ArrayList
Increasing Array Size
why is the ListCellRendererComponent called twice for every list item
generics 1.4
Dynamic String Array Decelaration