title: Key not found in map
body: <p>Given this very simple Variable - Clause model</p>
  
  <pre><code>class Variable(name: String, negated: Boolean = false) {
      def evaluate(b: Boolean): Boolean = negated match {
          case false =&gt; b
          case true =&gt; !b
      }
  
      def negate = new Variable(this.name, !this.negated)
  
      override def toString = negated match {
          case false =&gt; name
          case true =&gt; "~" + name
      }
  
      override def hashCode() = name.hashCode()
  
      override def equals(obj: Any) = name.equals(obj)
  }
  
  class Clause(vars: List[Variable]) {
      def evaluate(values: Map[Variable, Boolean]): Boolean = {
          val evaluatedVars = vars.map(v =&gt; v.evaluate(values(v)))
          (false /: evaluatedVars)(_ || _)
      }
  }
  </code></pre>
  
  <p>This simple assertion throws an exception</p>
  
  <pre><code>val c = new Variable("c")
  val d = new Variable("d")
  val c3 = new Clause(List(c.negate, d))
  assertTrue( c2.evaluate( Map(c -&gt; false, d -&gt; true) ) )
  </code></pre>
  
  <blockquote>
    <p>java.util.NoSuchElementException: key not found: ~c</p>
  </blockquote>
  
  <p>What am I missing?</p>