title: Groovy: Are two variables referring to the same object?
body: <p>I am debugging some Groovy code for a website and have hit an issue where I create an <code>object A</code> in controller in one part of the flow and set a variable within it (read it back and its correct). </p>
  
  <p>I then pick up what I had understood to the the same object in a different controller. But the variable is no longer set. </p>
  
  <p>Either my assumption that the <code>object A</code> in the first controller is the same <code>object A</code> as picked up the the second controller is wrong or something has modified the value en-route. </p>
  
  <p>So, what might be a very basic question (and I have have a horrible feeling that it points to some fundamental misunderstanding on my part of how Groovy/Java works - so please be gentle) :
  How can I tell if the <code>object A</code> in <code>controller 1</code> is the same as the <code>object A</code> in controller 2 (by the same I mean point to the same object, not that they are equivalent).</p>