Created
February 11, 2013 17:05
-
-
Save tpolecat/4755770 to your computer and use it in GitHub Desktop.
Map wrapper can easily return Some(null)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.convert.Wrappers.JMapWrapper | |
import java.util.Collections | |
object MapTest extends App { | |
val m = new JMapWrapper(Collections.synchronizedMap(new java.util.HashMap[String,String])) | |
new Thread { | |
override def run { | |
while (true) { | |
m += ("foo" -> "bar") | |
m -= "foo" | |
} | |
} | |
}.start() | |
new Thread { | |
override def run { | |
while (true) { | |
if (m.get("foo") == Some(null)) | |
println("got null") | |
} | |
} | |
}.start() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment