This is for a red black tree.
For the pseudocode "p[z] <-- y", would the interpretation in java be:
z.getParent() = y;
The correct code would be
Be aware that
z.getParent() = y; is invalid code. The assignment operator
= stores the result of evaluating the expression to the right of the
= into a variable, attribute or array position to the left of the
=. In an expression like the first one in your question, you'd be trying to assign the value
y into the result of calling
z.getParent() - that is, trying to assign a value into another value, and that won't work.
The right way to change an attribute is by calling the corresponding
setXXX() method, or by directly assigning to the attribute if it was declared non-private, like this:
z.parent = y;