|
-
June 21st, 2005, 04:29 PM
#5
Re: What's the difference between LinkedList and ArrayList?
 Originally Posted by love2mao
ArrayList implements interface RandomAccess, while
LinkedList not. I've thought LinkedList doesn't support random
success. However, cgecking its methods, I found out that it DOES!
Code:
set(int index, Object element)
// Replaces the element at the specified position in this list with the specified
element.
Then looks like one of them is redundant? Am I right?
Thank you.
that an element can be retrieved from the centre of a sequential flow of data does not necessarily confer that the data is accessed randomly (i.e. directly, without need to traverse the stream first)
a linked list is like a audio tape or a backup tape; you can find a file on it/song on it but you have to stream through from one end to the other. its very quick to add more tape to the end; just splice it in.
An arraylist is more like a keyboard; you can see the key you want to press, you go straight to it. to add more keys is a major operation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|