title: How can I flatten HashMaps and get only a list of keys in Kotlin?
body: <p>I need to get only a list of keys from a hash map.</p>
  <p>Here is how I do it:</p>
  <p>data is hashmap type.</p>
  <pre><code>val flatten = data.flatMap { it.entries }
  val keys = flatten.map { it.key }
  </code></pre>
  <p>As you can see on the rows above first, the data is flattened, and then with help of the map method I create a list only of keys.
  But it looks like that <code>flatten.map { it.key }</code> work slow.</p>
  <p>My question is, is there any other way to fetch a list of keys from Hashmap, or how can I improve the performance of the code above?</p>