Stack as a parameter

_al3xis_al3xis Greece
edited March 2014 in Java Beginners

Hi everyone.
I am implemmenting an avl tree in java.
I use a Stack to store the path of inserting a new node.
I use it then as a parameter in a method like this:

public void update(Stack<Node> path) 
    Stack<Node> temp = path;

        Node node = temp.pop();
        node.height = height(node);

After the excecution, my path is empty.
Shouldn't it be just the temp empty?
I also tryed declaring the temp path before calling the method and using the temp as a parameter for the method.
Same thing happened. After the excecution, my path is empty.
Can anyone help me, please?
Please excuse my bad English.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!