aspose file tools*
The moose likes Cattle Drive and the fly likes What is the best Data Structure to implement a Stack 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 » This Site » Cattle Drive
Bookmark "What is the best Data Structure to implement a Stack" Watch "What is the best Data Structure to implement a Stack" New topic
Author

What is the best Data Structure to implement a Stack

Herbert Morriss
Greenhorn

Joined: May 21, 2005
Posts: 16
I want a Stack Data Structure ( LIFO ). I see Stack (which inherits from Vector), I understand using Vectors is out, correct? Is ArrayList the one I want to use? The only thing I do need is to be able to get the size without having to build a function myself.
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
Are you using this for a Cattle Drive assignment? If not, you may be better off posting in another forum. I'm not sure which forum would be most apropos, but I'm thinking Java in General or the Beginning Java forum.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
I think that LinkedList would be a better fit than ArrayList, although I would probably use Stack if I needed that behavior (which I haven't needed for any of the projects I've worked on to date). If you only need the size, ArrayList would be just fine.
[ April 19, 2006: Message edited by: Marilyn de Queiroz ]

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Herbert Morriss
Greenhorn

Joined: May 21, 2005
Posts: 16
Thanks, I will give it a shot and see what you say when you see my assignment 5.
Herbert Morriss
Greenhorn

Joined: May 21, 2005
Posts: 16
opps, that was assignment 4, say.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the best Data Structure to implement a Stack
 
Similar Threads
Data Structure Abstraction
Stack implementations
Stack and Queue Implementation
moving in a maze
palindrome not very proficient...