title: Kotlin. Unchecked cast: Any? to HashMap<String?, String?>?
body: <p>I want to get <code>HashMap&lt;String?, String?&gt;?</code> from <code>firebaseDatabase</code>:</p>
  
  <pre><code>override fun onDataChange(dataSnapshot: DataSnapshot) {
      val users: HashMap&lt;String?, String?&gt;? = dataSnapshot.value as HashMap&lt;String?, String?&gt;?  // todo !!!
      if (users != null) {
          if (!users.containsKey(userUid)) {
              users[userUid] = userName
          }
      }
  }
  </code></pre>
  
  <p>This code works but <code>Android Studio</code> shows a warning on a 2nd line:</p>
  
  <pre><code> Unchecked cast: Any? to HashMap&lt;String?, String?&gt;?
  </code></pre>
  
  <p>How to fix this in a proper way?</p>