title: Groovy Grails - Problems retrieving values from Map by key
body: <p>Something odd is going on in the following code.  I successfully create a map, and as shown in the output I have keys and values, but I can't retrieve the values with the key.  </p>
  
  <p>See code and output below:</p>
  
  <pre><code>class HomeController {
  
  def index() {
      List gs=Gizmo.getAll()
     def gizmoList= gs.collectEntries {
          [(it.id): (it.name)]
      }
  
  
      println "item 2 is ${gizmoList['2']}"
  
      println "item 2  is ${gizmoList[2]}"
      println "keyset is " + gizmoList.keySet().toList().toString()
      println "values are" + gizmoList.values().toList().toString()
      [myList: gizmoList ]
   }
  }
  </code></pre>
  
  <p>the console output is:</p>
  
  <pre><code>item 2 is null
  item 2  is null
  keyset is [1, 2, 3]
  values are[flange, nork, prule]
  </code></pre>
  
  <p>Somehow I think the keys maybe GStringImpl or something, but I thought putting parens around would coerce to plain strings.  </p>