There is no real need for StackNode. Just use generics to store the specified item directly into the Stack/Deque. This also prevents pushingpushing and integerint and poppingpopping a StackNodeStackNode, which is inconsistent.
Also, if there is a method of keeping track of the current stack, the logic for checking also becomes easier.
Something like this:
public void push( T item )
{
//Make room if needed
ensureRoom();
//The current stack has enough room to push the item
currentStack().push( item );
}
(note that this is not thread-safe)
Besides easier to read, it also becomes easier to refactor. For example, if you decide not to use Deque but Stack or your onwown implementation, it is easier to change.