title: Kotlin - Storing and reading an array in hashmap
body: <p>Noob to Kotlin. I have a hashmap and which would hold an array for one of it's keys. However when I read the value for that key, Kotlin is not recognizing it as an array.</p>
  
  <p><strong><em>My hashmap:</em></strong></p>
  
  <pre><code>var myHashMap = hashMapOf("test" to arrayOf&lt;HashMap&lt;String, Any&gt;&gt;())
  </code></pre>
  
  <p><strong><em>Reading the array:</em></strong></p>
  
  <pre><code>var testString = "__ ${myHashMap["test"].count()} __"
  </code></pre>
  
  <p>I am getting type mismatch error when I try to read the value. I am storing the array in hashmap in incorrect way?</p>
  
  <p>My hashmap is of type HashMap. I am just specifying the type for the value now and will be storing the actual values dynamically later. </p>
  
  <p>So later when I read myHashMap["test"], I would be expecting something like ["Hello": "World", "ABC": 3]</p>
  
  <p>Edit: Adding my solution</p>
  
  <p>I tried this and it worked for now, but checking if there is a better solution.</p>
  
  <pre><code>    var tests = task["test"] as ArrayList&lt;HashMap&lt;String, Any&gt;&gt;
      var testCount = tests.count()
  </code></pre>
  
  <p>Also if I want to keep adding values to myHashMap["test"] for now I am storing the existing values into var, adding new onto it and then passing it out to myHashMap["test"].</p>
  
  <pre><code>tests.add(someHashMap)
  myHashMap["test"] = tests
  </code></pre>
  
  <p>Any quicker way to achieve this?</p>