• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the best Data Structure to implement a Stack

 
Herbert Morriss
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1202
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Herbert Morriss
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I will give it a shot and see what you say when you see my assignment 5.
 
Herbert Morriss
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
opps, that was assignment 4, say.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic