Look at the documentation for the two.  What are the performance 
characteristics that differ?  
Do you need that difference?

There is not any such thing as 'LinkedList' is "better" than 'ArrayList' 
except in the context of specific 
operations that only you can evaluate, because it's in your project.  Do 
you need items to 'remove()' quickly?
Do you need to convert the 'List' to an array easily and quickly?

Read the docs.  I will add that in my own experience 'ArrayList' is usually 
the "better" choice, and if you find 
it doesn't matter, use 'ArrayList'.

Either way, the variable or return type to which the list is assigned 
should be 'List' (or even 'Collection') and 
not either of the concrete types.

-- 
Lew

On Sunday, December 18, 2011 5:27:34 AM UTC-8, bob wrote:
>
> Let's say you are making a game for Android.  You want a container to
> store the list of enemy ships… maybe a linked list…  maybe an array.
>
> Which is probably better?  LinkedList or ArrayList?  Or, is there
> something I haven't thought about that's better than those two?
>
> I would think LinkedList would be better in theory, but I saw
> ArrayList being used in this Android game book I bought… Beginning
> Android Games.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to