aspose file tools*
The moose likes Beginning Java and the fly likes Linkedlists vs vectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Linkedlists vs vectors" Watch "Linkedlists vs vectors" New topic
Author

Linkedlists vs vectors

Ugochukwu Onwordi
Greenhorn

Joined: Oct 25, 2007
Posts: 11
Hi,i'm currently studyn d collections framework,bt i'm having trouble identifying when 2 use a linked list instead of a vector.is there much of a difference between them?are there any general guidelines as 2 which one is best 4 a given scenario?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Please use real words (e.g., "to" and "for" rather than "2" and "4").


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

See the topic Choosing an implementation from the Collections chapter of Eckel's Thinking in Java. (And note that it says, "Hashtable, Vector, and Stack ... are legacy classes, so that old code doesn't break. ...it�s best if you don't use those for new code." In general, use an ArrayList in place of a Vector.)

In comparing ArrayList to LinkedList, you will see (for example) that an ArrayList allows for fast random access, while a LinkedList allows for fast insertions and deletions from the middle.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Wow, I like Eckell, but All those bold words make me bug eyed. Here's a simple crib sheet for the most common (couldn't resist) choices.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Stan James:
Wow, I like Eckell, but All those bold words make me bug eyed...

I agree.

For what it's worth, his convention is...
...identifiers (method, variable, and class names) are set in bold. Most keywords are also set in bold, except for those keywords that are used so much that the bolding can become tedious, such as "class."

Hmmm... We certainly wouldn't want bolding to become "tedious."
:roll:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Linkedlists vs vectors
 
Similar Threads
Getting response values in a text box
Who have the fish?
Multithreading in Quartz Scheduler
Duplicate code
microsoft big ass table