In general, very few bits of code in Java go around arbitrary copying of objects. peek will return the link that is on the top of the stack ... do not forget that objects are not on the stack, in the first place, only links.
So, in your example, you really change the name of the object referenced by the link in the stack.
source share