title: What do empty square brackets after a variable name mean in Groovy?
body: <p>I'm fairly new to groovy, looking at some existing code, and I see this:</p>
  
  <pre><code>def timestamp = event.timestamp[]
  </code></pre>
  
  <p>I don't understand what the empty square brackets are doing on this line. Note that the timestamp being def'd here should receive a long value.</p>
  
  <p>In this code, <code>event</code> is defined somewhere else in our huge code base, so I'm not sure what it is. I thought it was a map, but when I wrote some separate test code using this notation on a map, the square brackets result in an empty value being assigned to timestamp. In the code above, however, the brackets are necessary to get correct (non-null) values.</p>
  
  <p>Some quick Googling didn't help much (hard to search on "[]").</p>
  
  <p>EDIT: Turns out event and event.timestamp are both zero.core.groovysupport.GCAccessor objects, and as the answer below says, the [] must be calling getAt() on these objects and returning a value (in this case, a long).</p>