I have a question which is related to the Stack implementation in the Collections framework in Java.
- I can see from the implementation that the size of the Stack can grow. Does this mean that a
StackOverflowError
can never occur and eventually the Stack reaches a size and anOutOfMemoryError
occurs? - From googling I found that the
Vector
class is deprecated since it synchronizes each and every operation as Jon Skeet pointed out here: Is Java Vector deprecated?
So, after this is there any real life scenario where I would use this Java class? I don't want to synchronize on each and every operation and want to synchronize on a bunch of operations. Can somebody give a real life situation/example.