This class is an internal utility that just treats an array as a stack
and gives us a top() method so we don't have to write expressions like
ancestors[ancestors.length-1]. The values() method automatically
copies the internal array so we don't have to worry about client code
modifying our internal stacks. The use of this Stack abstraction makes
the TraversalState class simpler in a number of places.
This class is an internal utility that just treats an array as a stack and gives us a top() method so we don't have to write expressions like
ancestors[ancestors.length-1]. The values() method automatically copies the internal array so we don't have to worry about client code modifying our internal stacks. The use of this Stack abstraction makes the TraversalState class simpler in a number of places.