Why not StringBuilder= (string) in scala?
•
Java
This behavior seems to be broken (I'm using scala 2.9.1)
var b= new StringBuilder
All right:
b+='a' b.append('b') b.append("de")
This results in compilation errors:
b+="de"
Any idea, why only StringBuilder #= (C: char) exists, and StringBuilder #append (C: char) and StringBuilder #append (s: String) coexist happily? What is the problem with declaring and implementing StringBuilder #= (s: String)?
Are there any monitoring or deeper problems in the scala type system?
Solution
Try B = "de" Strings are considered a collection of chars
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码