#Java data structures

12 messages · Page 1 of 1 (latest)

ocean marlin
#

Ok guys i have 2 questions, i am learning data structures so how to use stacks? tutor says that if u want to use stacks its better to back stack with linkedlist create extra class and define methods there because linkedlist implements deque interface too, but i searched in google and people create stacks by itself like stack<String> example = new stack<string>(); why ?

earnest smeltBOT
#

This post has been reserved for your question.

Hey @ocean marlin! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

ocean marlin
#

and can u show me real life prroejct where u use stacks

toxic nebula
#

It's just that Java's java.util.Stack class is outdated. All accesses to it are synchronized, which might have sounded like a good idea at the time, but takes a performance toll that nobody wants in practice.
LinkedList replaces it fine.

viral girder
ocean marlin
#

ok thank you guys

earnest smeltBOT
# ocean marlin ok thank you guys

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

ocean marlin
#

so hashsets is good data s tructure because every element is unique right?

viral girder
ocean marlin
#

every element in hashets are unique

viral girder
#

yeah that is correct.