Should a Stack have a maximum size?

Posted by Sotirios Delimanolis on Stack Overflow See other posts from Stack Overflow or by Sotirios Delimanolis
Published on 2012-04-01T05:26:49Z Indexed on 2012/04/01 5:28 UTC
Read the original article Hit count: 368

I'm practicing my knowledge of ADTs by implementing some data structures, even if most already exist. With Stacks, a lot of books and other documentation I've read talk about the stack throwing an error when you try to add an element but the stack is full. In a java implementation (or any other), should I specifically keep track of a maximum stack size (from constructor), check to see if that size is reached, and throw an overflow exception if it is? Or is not such a big deal?

© Stack Overflow or respective owner

Related posts about java

Related posts about stack