title: Is there a way to filter out null Any? values in Kotlin Map?
body: <p>I'm trying to think of a function that would allow a <code>Map&lt;String, Any?&gt;</code> object to be treated as <code>Map&lt;String,Any&gt;</code> through type inference through applying a single function.</p>
  
  <p>I am pretty new to the transformation functions in Kotlin and have tried the various <code>filter</code> and <code>filterValues</code> <code>filterNot</code> on the map like so:</p>
  
  <pre><code>val input = mapOf(Pair("first",null))
  val filtered: Map&lt;String,Any&gt; = input.filter { it.value!=null }
  </code></pre>
  
  <p>it also fails to compile with any of these</p>
  
  <pre><code>input.filterValues { it!=null }
  input.filterNot { it.value==null }
  input.filterNot { it.value is Nothing }
  </code></pre>
  
  <p>The closest I can seem to get is applying multiple steps or having an Unchecked cast warning. I would have thought that filtering the values to be <code>!=null</code> would suffice. My only other thought is that it's due to the generics?</p>