Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

What is the flaw with the Stack class?



java.util.Stack extends java.util.Vector. Instead of an is-a, it should've been a has-a. The way it currently is, you can insert elements at any arbitrary index and do other Vector-like but not Stack-like behavior on a Stack.