filterKeys

trait Map[K, V] {
  def filterKeys(p: (K) => Boolean): Map[K, V]
}

filterKeys creates a Map with those key-value pairs whose key satisfy the predicate p and discarding the rest.