Map containing Objects not working as expected Scala
<p>Trying to understand basic Scala concepts. Why is this code not compiling ? </p>

<pre><code> case class User(
               id: Int,
               firstName: String,
               lastName: String,
               age: Int,
               gender: Option[String])

object UserRepository {
 val users = Map
 ( 1 -&gt;  User(1, "John", "Doe", 32, Some("male")),
   2 -&gt; User(2, "Johanna", "Doe", 30, None)
   )
//def findById(id: Int): Option[User] = users
//def findAll = users.values
def getUsers() = { users }
}

for ((k,v) &lt;- UserRepository.getUsers() ){
 println(v)
}
</code></pre>

<p>Error:(25, 42) value filter is not a member of object cala.collection.immutable.Map
    for ((k,v) &lt;- UserRepository.getUsers() ){</p>

<p>I expected that val users is holding Map ? </p>

<p>Simple map is working fine: </p>

<pre><code>val simpleMap = Map (1 -&gt; "First", 2 -&gt; "Second")

for ((k,v) &lt;- simpleMap ){
 println(v)
}
</code></pre>