tags:

views:

96

answers:

1

Possible Duplicate:
Int vs Integer: type mismatch, found: Int, required: String

Suppose you inadvertently use Integer instead of Int, as in this code:

import scala.collection.mutable.Map

val contributors = Map[String,Integer]()

val count = contributors.getOrElseUpdate("john",0)

contributors.put("john",count+1)

println(contributors)

Compiler output:

(fragment of test.scala):7: error: type mismatch;
found   : Int(1)
required: String
contributors.put("john",count+1)
                           ^

Why "required: String"?

+2  A: 

Check the answer in other post.

Tofouzand2000